Layered architecture
We try to divide our code and implementation into different layers, and each layer will have a fixed responsibility. There is no fixed set of layering that can be applied to all the projects, so you may need to think about what kind of layering will work for the project in hand.
The following diagram shows a common layered architecture, which can be a good starting point when thinking about a typical web application:
The design has the following layers:
- Presentation layer
- Controller/web service layer
- Service layer
- Business layer
- Data access layer
The Presentation layer is the layer that holds your UI, that is, HTML/JavaScript/JSPs, and so on. This is the layer that the end user can directly interact with.
The Controller/web service layer is the entry point for a request from a third party. This request can come from the presentation layer (mostly) or from another service; for example, a mobile or desktop application. As this is the entry point for any request, this layer will...