602 total views
Most of the enterprise level software comprises of a 3 Layer architecture and every developer must know about it.
What is 3 Layer Architecture?
3 Layer architecture is a client-server architecture in which we break our application’s logic and implement them in different layers.
Any typical application will have GUI(User Interface), Business Logic and Database to store its data.
What are the three Layers?
The first layer as we call it is Presentation Layer
It comprises of all the logic related to GUI or User Interface.
Second and the most important layer will be Business Layer
It comprises of Business Objects and the code which deals with these objects.
The third layer will be the Data Access Layer
This layer will facilitate you to interact with a Database for example MySQL, Oracle, NoSQL DB, etc.
In the Above Diagram, you can see all the entities of a 3 layer architecture of any software comprising :
- Presentation Layer
- Business Layer
- Data Access Layer
- Data Transfer Objects
But wait, we never discussed about the Data Transfer Objects so here the question is:
What is Data Transfer Objects aka DTO?
DTOs are the POJO classes that an application uses to transfer data from one layer to another.
DTO has different name on different layers for example in struts on Presentaion layer its called beans.
On Business Layer it is called Model or Value Objects.
And on DAO it can be called as Par or Persistent Objects.
Advantages of 3 layer architecture
- Three layers can act like three different projects having a reference of others.
- Code changes on one layer do not affect the other layers.
- Easy to migrate from one type of GUI to another or one type of DB to another because of changes required on a specific layer only.
- Easy to version control which leads to less number of Merge conflicts.
In conclusion, 3 layer architecture eases out a lot of coding and deployment task on your day to day life and every developer must know about it right from the beginning.