The three-tier architecture is logically divided into the entire business: the presentation layer (UI), the Business Logic layer (BLL), the data Access Layer (DAL) in order to achieve "high cohesion, low coupling" purposes.
1, three layer structure
1) Presentation layer (UI): mainly refers to the interface that interacts with the user. Used to receive data entered by the user and to display the data that the user needs after processing.
2) Business Logic Layer (BLL): A bridge between the UI layer and the BLL layer. For detailed problem operation, the data business logic is processed.
3) Data access Layer (DAL): dealing with databases.
The main operation is to the database for the increase and deletion check. It does not refer to the database where the raw data is stored, but to some manipulation of the data.
Direction of data transfer between layers three:
The three-layer design requires a physical layer (entity) to adjust. The entity layer does not belong to any layer, but it is an indispensable part. The dependency between the entity class and the three layer is:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmdkyndg5nw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
The solid layer runs through three layers and transmits data between three layers.
We can understand that each data table corresponds to an entity, and the fields in each data table correspond to the attributes in the entity.
The need for entity classes is due to. From the point of view of the object, it is a completely controlled object with the basic characteristics of facing the object, which can define its own behavior. You can eliminate the differences between relational data and objects.
2. Why
The layering is done in order to achieve "high cohesion, low coupling".
The layered process is the decoupling process, simplifying the complex problem. When a project is more complex and the database access and storage issues are designed, you can use layer three to simplify it.
Using layer three has some advantages:
1) Developers can only focus on one layer of the entire structure;
2) can be very easy to replace the implementation of the original level with the new implementation;
3) can reduce the dependence between layers and layers.
4) conducive to standardization;
5) facilitates the reuse of all layers of logic.
6) More understanding of the structure
7) significantly reduced maintenance costs and maintenance time during post-maintenance
3. Construction Steps
1) Build the presentation layer (create a Windows application)
2) Building the business Logic layer (class library)
3) Building data access Layer (class library)
4) adding interdependencies between tiers (avoid cross-referencing)
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Three-tier architecture