Three-tier architecture, three-tier architecture and mvc difference
01. What is a three-tier architecture?
01. user Interface layer: receives User input, presents the output to the User, verifies access security, and is responsible for the correctness, validity, and presentation style of the input data, however, we are not responsible for the correctness of the output data.
02. Business Logic Layer: responsible for processing Business in the system field and generating, processing, and transforming logical Logic. Responsible for the correctness and effectiveness of the entered logical data, but not for the correctness of the output Logical Data and user data, and for the data presentation style.
03. data Access Layer: It is responsible for interacting with the Data source, that is, Data insertion, deletion, modification, and reading Data from the database, however, you are not responsible for the correctness and validity of the data. You are not responsible for understanding the purpose of the data and are not responsible for processing any business logic.
02. How do I build a layer-3 architecture?
Model: converts a column in a data table to an attribute in an object class.
DAL (Data Access Layer): responsible for interacting with databases. All SQL statements must appear at this Layer.
BLL (Business Logic Layer): isolates the DAL and UI layers and returns the DAL data to the UI Layer.
UI (User Interface layer): displays the Interface.
Common: tool class layer. It is responsible for calling the UI that is unrelated to the database.
Call relationship:
01. Reference Model for all layers
02. BLL depends on DAL and Model
03. UI depends on BLL, Common, and Model
04. Model: does not rely on any Layer
Reference relationship:
DAL: Model
BLL: Model, DAL
UI: Model, BLL, Common
Common:
03. What are the advantages of a layer-3 architecture?
Resolution:
Advantages:
1. developers can only pay attention to one of the layers in the entire structure;
2. It is easy to replace the original implementation with the new implementation;
3. The dependency between layers can be reduced;
4. conducive to standardization;
5. facilitate the reuse of logic at each layer.
6. Strong scalability. Different layers are responsible for different layers. For example, PetShop can achieve conversion between Sqlserver and oracle through simple configuration,
Of course, after writing, the conversion between B/S and C/S can also be realized.
7. High security. The user can only access the data layer through the logic layer, reducing entry points and shielding many dangerous system functions.
8. The project structure is clearer and the division of labor is clearer, which is conducive to later maintenance and upgrade.
Disadvantages:
1. Reduced system performance. This is self-evident. If the hierarchical structure is not used, many businesses can directly access the database,
To obtain the corresponding data, it must be done through the middle layer.
2. Cascade modifications may sometimes occur. This kind of modification is especially reflected in the top-down direction. If you need to add a function in the presentation layer,
To ensure that the design conforms to the hierarchical structure, you may need to add the corresponding code in the corresponding business logic layer and data access layer.
3. added the amount of code and workload.