Tuesday, September 20, 2016

thumbnail

Software Architecture - Three Layers Should Be Enough for Everybody

Three Layers Should Be Enough for Everybody

If think about the responsibilities of a web application, we notice that a web application has the following “concerns”:
  • It needs to process the user’s input and return the correct response back to the user.
  • It needs an exception handling mechanism that provides reasonable error messages to the user.
  • It needs a transaction management strategy.
  • It needs to handle both authentication and authorization.
  • It needs to implement the business logic of the application.
  • It needs to communicate with the used data storage and other external resources.
We can full fill all these concerns by using “only” three layers. These layers are:
  • The web layer is the uppermost layer of a web application. It is responsible of processing user’s input and returning the correct response back to the user. The web layer must also handle the exceptions thrown by the other layers. Because the web layer is the entry point of our application, it must take care of authentication and act as a first line of defense against unauthorized users.
  • The service layer resides below the web layer. It acts as a transaction boundary and contains both application and infrastructure services. The application services provides the public API of the service layer. They also act as a transaction boundary and are responsible of authorization. Theinfrastructure services contain the “plumbing code” that communicates with external resources such as file systems, databases, or email servers. Often these methods are used by more than a one application service.
  • The repository layer is the lowest layer of a web application. It is responsible of communicating with the used data storage.

About me

simple one.