Layers and Tiers
In Software Architecture, we often come across the terms Layers and Tiers. Layers are logical entities, whereas Ties are physical entities.
Layers:
Layers define how the code is logically organized or grouped. The above diagram shows various layers in a web application.
Examples:
- Presentation Layer – is the layer which consists of UI logic.
- Business Layer– is the layer which consists of business logic.
- Data Layer– is the layer which consists of data.
Tiers:
Tiers define how the system is organized physically. For e.g., it can define how are the different components of the system located or deployed. The above diagram shows various tiers in a web application.
Examples:
- Client Tier
- Data Tier
- Messaging Tier
Importance of Layers:
Defining layers is important in order to have code maintainability, separation of concerns and in defining the technology stack. For instance, Presentation and Business Layers might be deployed on the same machine (i.e. thereby they belong to the same tier). However, these two layers will be isolated from a code perspective. Any change to the presentation component need not impact the Business Layer.
Importance of Tiers:
Defining Tiers is important from Security, Transactions and Scalability perspective. Communication between Tiers will draw the attention of Network and Operations to ensure that they are secure and scalable. Also, the deployment strategy of the application will depend on the Tiers and tiers define the system topography. Tiers provide a view of how different systems communicate from a Network perspective.
For instance, the database tier might need additional network security measures to ensure security of the data. Similarly, the web tier might need additional network monitoring as it could be exposed to the internet.