In this article, we want to talk about layers and tiers in software architecture and talk about the difference between them, and after that, in the next articles, we can talk about layers and tiers in detail.
This article is the first of a series about Web Applications Architect.
Nowadays we use multi-layer architecture in a wide range of web applications and we make microservices or other architectures for multi-layer applications.
If we want to talk about layers, we can say, each layer in an application, is a software separate part of our app that each layer has a separate duty.
For example, we can create 3 layer app with a separate controller REST API, service, and data access layer.
You can create a new layer for each logic in your app and create distinct departments to manage that part.
Tiers are separate parts like layers but these parts are in deferent physical machines. What's mean?
For example, if you run all 3 parts in the top example (in layer part) in one machine, you have a one-tier application.
Come with me with some examples for understanding better.
Imagine we have a to-do list application. This app has a mobile app, website, restful API, and a database.
This image is our architect for this application:
In this application, we have an app with 5 layers and 3 tiers.
In the image, I specified each tier with purple color.
The first tire is the client's phone. Because that is hardware and we run our application in that. so we have a tier for running our application.
The second tier is our hardware to execute back-end codes (but we have 3 different sections that we talk about in layers).
And the third tier is database hardware to save our data in the database.
know I think you understand why we have 5 layers. because we have one layer on the client-side (our mobile app), one layer for our database, and in the second tier we have 3 layers! we separate our back-end logic into 3 parts.
first, we have Rest API for communicating with the mobile app, second is a back-end server for handle our logic on data and create data models, and finally, we have a Data Access layer to access our Database layer.
I hope my explanation was clear.
If you have any questions, please contact me in the comments section.
In the next sections, I will talk about layer and tier architecture in deep.