Three-tier architecture (a)

Three-tier architecture :

Three-tier architecture in the usual sense that the whole business application is divided into: an interface layer (User Interface layer), the business logic (Business Logic Layer), data access layer (Data access layer). I.e., to distinguish the object level " high cohesion and low coupling thinking". In the software architecture design, the hierarchical structure is the most common and also the most important kind of structure. Recommended by Microsoft hierarchical structure is generally divided into three layers, from bottom to top are: a data access layer, business logic (also referred to as a field or layer), the presentation layer.

 

As the name implies, three-tier architecture is divided into three layers, namely the "Data Access Layer", "business logic layer", "presentation layer."
Data Access Layer: data access layer to access the file during the job data in the system, to realize the read operation for saving data in the database.
Presentation Layer: The main function is to display data and accept the transfer of user data, can provide an interactive interface for the system is running the site, represents the application layer of the more common ways, such as Windows Forms and Web pages.
Business logic: The user's input information screening process, were preserved. Create new data is stored in the storage during the data reading, the "business logic" code description contained.
Three-tier software system for the transmission of user data, extract, create favorable conditions for storage. In the application of data, information architecture development projects division of responsibilities among the various levels were clearly planning, thus reducing the risk of website maintenance system.
principle:
Three levels, the main functions and business logic are handled at the business logic layer.
The so-called three-tier architecture, is between the client and the database to join a "middle layer", also known component layer. The three-tier system here, Not refer to three physical nor the machine is simply placed three-tier architecture, of course, not only have B / S is the application of three-tier architecture,
Layer three logical means, i.e., these three layers placed on one machine.
Applications will be three-tier system business rules, data access, check the legality of work into the middle layer processing. Typically, the client does not directly interact with the database, but to establish a connection through the COM / DCOM to communicate with the intermediate layer, the intermediate layer and then through the interaction with the database.
The main function of the three-tier architecture, business logic and general information processing to be implemented in the business logic layer, three-tier architecture in which the client and the database to pre-intermediate layer, layer to be formed. Three-layer three-tier system with a certain logic, that is, the three-set to the same computer system, the service agreements, legal verification data access and program-location information to the intermediate layer processing, the client generally database and not for data transmission, mainly using COM / DCOM communications channel adapters constructed and the intermediate layer, the intermediate layer, data transmission to the database, so as to realize an interaction with the client database.
 
Structure :
 

Presentation layer

The presentation layer presentation layer, also known as UI, located in the uppermost layer of the three-tier architecture, direct contact with the user, mainly B / S information system in the Web browser page. As the Web browser page, showing the main functional layer was achieved with the incoming system data output, this process does not require the determination by the logic operation can BLL transferring data to the data processing system, post-processing process will result feedback indicating layer. In other words, the presentation layer is to implement user interface features, will convey the user's needs and feedback, and debugging BLL or Models, ensure the user experience.
 

Yewuluojiceng

BLL business logic function is determined with the logic to perform operations on specific issues, upon receiving a user instruction UI presentation layer, and connects the DAL data access layer, presentation layer and access layer is the data layer, an intermediate position in the three-tier architecture, also represents a bridge layer and data layer, data and instructions between the three connections convey, logical processing may be performed on the received data, modify data to achieve, access, delete, etc., and the results fed back to the UI presentation layer , the realization of software functions.
 

Data Access Layer

Data Access Layer DAL is the main control system database, the added data, delete, modify, query and other operations, and operating results back to the business logic BLL. During the actual operation, the data access layer is no logical judgment, in order to achieve rigor write code, improve code reading extent, general software developers will write DataAccessCommon in this layer to ensure data access layer DAL data processing functions.
Select simplest way is to realize the data table (query), Insert (insert), Update (update), Delete (delete) operations. If you want to add an element of ORM, it will include mapping between objects and data tables, and object entity persistence.
Data access layer, simply put, is through SQL statements to the database and other DAL operation.
The main responsibilities of database access layer is: read data and transfer data.
 
 
The role of each layer
1, data access layer: mainly on non-raw data (database or text file stored in the form data) handle layer, rather than the raw data, that is, the operation of the database, instead of the data, particularly for the business The presentation layer provides a logical layer or data services.
2, business logic layer: mainly operation of specific problems, can also be operated in pairs to understand the data layer, business logic processing of the data, if the data layer is a building block, logic layer that is to build on these building blocks.
3, interface layer: mainly showing the WEB way, can also be expressed as WINFORM way, the WEB can also be expressed as: aspx, if the logical layer quite powerful and perfect, regardless of the presentation layer to define and change the logical layer can improve the delivery of services
for example

Waiter: just to receive guests;

Chef: just do the dishes the guests point;

Buyer: just press the procurement requirements of the guests a la carte food;

They each bear their job, waiters do not have to learn how to cook to cook, do not understand how buyers purchase ingredients;

Chef waiter do not know who received the guests, buyers do not know how to purchase ingredients;

Similarly, buyers do not know the waiter who welcomed the guests, do not know how to cook to cook.

That is how they linked the three?

Customers and staff directly dealing with customers and waiters ( the UI layer) said: I want a fried eggplant, fried eggplant and is not responsible for the waiter, she took up the request submitted, passed to the chef ( BLL layer), the chef needs eggplant, put request submitted up, passed to the buyer ( DAL layer), a buyer from the warehouse to fetch eggplant back to the chef, cooks response cookEggplant () method, good fried eggplant, then back to the waiter, the waiter presented the eggplant to the customer.

This completes a full operation.

In this process, eggplant passed as a parameter in three layers, if the customer point of scrambled eggs, the eggs as a parameter (which is variable as an argument). If user demand increases, we have to add in the method parameter, add a one way, a method designed to three; not to mention the reality and not just a design to change the method. Therefore, in order to solve this problem, we can put the eggplant, eggs, noodles defined as an attribute to the customer entity, once customers increased demand scrambled eggs, eggs directly to the property can be used out, did not have to consider ways to each of added parameters, and not to consider the matching parameters.

Say this, we should be able to understand it

This content is only part of the other part see my another blog

( Three-tier architecture two )

 

 

 
 

Guess you like

Origin www.cnblogs.com/xuedine/p/11767419.html