Understand the three-tier architecture (presentation layer, business layer, persistence layer)

Three-tier architecture: the presentation layer, the business layer, persistence layer.

Lying about three layers.

For example 1 + 1 =?
You enter 1 + 1 =? The place is the presentation layer, the business layer 1 + 1 =? Split into "1", "+", "1", "=", "?", And several other elements, then tell the persistence layer to save these elements together, and then he calculated brains? How much, and tell the persistence layer 2 save up the deposit, then the value 2 is returned to the presentation layer, allowing you to see the results of 2;
therefore, the business layer is the core of this inside , very important, he has a brain but no memory, he would like to take persistence to working memory;

① Persistence layer: DAO mode, the entity class and to establish database table mapping (ORM mapping). That is, which class corresponds to which table, which column corresponds to which property. The purpose is to persistence layer, to complete the conversion object data and relational data.

② business layer: Transaction Script mode. The operation of a business, all packaged as a method, while maintaining all of the database update process operation, i.e., while ensuring to

    Success or failure at the same time. Avoid partially successful partial failure caused data corruption operations.

③ presentation layer: The MVC pattern.

               It referred to as model M, i.e. entity class. For the transmission of data encapsulation and data.

               V is a view, GUI component that is configured to display data.

               C is controlled, that is an event for controlling the flow of

 

Design Principles:

           Service layer interface design principles: a physical interface to a class, commit a business method. Business methods of argument from the presentation layer.

           Interface persistence layer design principles: a physical interface to a class, a persistent database operation method.

Released six original articles · won praise 3 · Views 796

Guess you like

Origin blog.csdn.net/SmileLucki/article/details/105208071