So what are the advantages and disadvantages of using layered architecture? The following is a detailed introduction to computer training for everyone.
1. What is a layered architecture? Hierarchical architecture mainly divides software modules into multiple levels according to horizontal division.
The system is composed of multiple layers, and each layer is composed of multiple modules.
So how many floors are appropriate? IT training thinks that it is divided into different levels according to the complexity, and the basic hierarchical structure is three levels, namely, presentation layer, domain layer and data persistence layer.
Second, the benefits of hierarchical architecture 1, single responsibility: each layer is only responsible for one role, and the responsibility boundary is clear.
If the persistence layer is only responsible for data query and storage, then the field level is only responsible for processing business logic.
2. High cohesion: Layering means putting the same responsibilities at the same level, and all business logics are consistent at the domain level.
What are the advantages of doing so? Guangzhou Beida Jade Bird assumes that if the business logic is scattered in each layer, the modification function needs to be modified to each layer, and the codes of all layers need to be tested to test the business logic, which increases the complexity and testing difficulty of the whole software.
3. Easy to maintain. Put all external interfaces that are easy to modify and face changes into the external interface layer. If you modify the externally dependent interface, you only need to change the code of this layer.
Third, the shortcomings of the layered architecture 1, the development cost is high. Because multiple layers undertake their own tasks, it is necessary to add code at multiple levels to increase functions.
In this way, the development cost will increase.
Beida Jade Bird thinks that reasonable ability abstraction can improve multiplicity and reduce development cost.
2. Low scalability: Because there is a certain degree of integration between the upper and lower layers, all functional changes may participate in multi-layer correction.