How to Understand the layer-3 Structure

Source: Internet
Author: User

I have been looking for this knowledge point for a long time. I only know that it is an implementation method for the appearance layer, business traffic layer, and data layer separation. In the afternoon, I searched for this knowledge point on csdn, many posts have posted an understanding of the three layers. extract one of them and ponder over it.

------ Foolnet (foolnet)--------

A typical three-tier application system consists of the database layer, application service layer, and user interface layer, as shown below:

User Interface <==> application service layer <==> Database

In many places, the application service layer is called the business logic layer. Here, we refer to Sun Yamin's websharp middleware and development tool development book, which calls this layer the application service layer, in order to continue to divide the application service layer in the n-layer architecture, there is a layer called the business logic layer.
At the application service layer, data access, database persistence, business logic processing, data representation, and service appearance must be processed, therefore, the application service layer is generally divided into the data access layer, business rule layer, and business appearance layer, this is a classic N-layer architecture (also in petshop and duwarmish ).
If the architecture is designed based on the N-layer architecture, for example, for user operations, there are several classes from bottom to bottom, namely userentity and datauser (userdao), businessuser, usersystem (Business appearance layer), and user presentation layer.

We can continue to discuss this issue. If we look at the layered system from another perspective, it can be divided into physical and logical models. The physical model is hierarchical from the hardware and network of a system. If a system has a database server and a web server (on two computers respectively), there are several clients, the physical model of this system is three layers, which is consistent with the above-mentioned "typical three-layer application system" scenario. Many textbooks refer to the three layers. The logic model is more from the logic of the software. Program From the perspective of members, the software structure is generally refined at the application service layer to more logical layers, such
The above n-layer system is a common logical model. In general, the logic model has more layers than the physical model. This conclusion is drawn from an understanding.


The N-layer structure diagram is similar to the 7-layer structure of the ISO network protocol. The lower layer provides services (interfaces) for the upper layer, and the upper layer is the lower layer consumer. The current layer exchanges data with the adjacent layer, the most important thing here is how data is represented. Generally, an object is used. Here it is called an object. The transmission of object data can be divided into local and distributed conditions, also known as the transfer of objects inside and outside the process.
The transfer of the value in the process, in. NET data types are divided into value type and reference type. When the value type is transferred, a data is actually copied. There are two addresses and two values in one transmission; when the reference type is passed, a pointer is actually passed, and the specific value is only one.
In the out-of-process (distributed) object data transmission is also divided into pass by value and pass by reference, in.. NET Framework. When passed by reference, the object is always in the original process. If the customer wants to use this object, the object must be referenced. in net, the proxy is generally used for reference transfer. By value transfer, a copy is copied from a process to another process, so that the original and current processes each have a data object in. if the object in net can be replicated across processes, serialization must be used. The default object cannot be transferred across processes.
Assume that the client is a winform. Now we need to handle the user login process. There is a database on the server, and the service is WebService or remoting, there is a businessuser class Publishing Service. In order to use the login (string name, string PWD) method of businessuser, the client does not create a businessuser object on the client, the server uses the businessuser object (the businessuser object is stored in the server process). To use the businessuser object, a proxy is generally created, which is referenced.
If the client needs to obtain information about an order and the order is represented by the Order class, copy the order class to the client and display it to the user, then the order is passed by value. The client obtains a copy of the order, and then the order can interact with the local object, which avoids the overhead of calling object attributes or methods, but this increases the overhead of network transmission, when a large object such as dataset is specially transmitted.

In a distributed system, when to use reference-based and value-based transmission, you need to consider the design, which generally represents the reference method for business processing, the persistence object is passed by value. The entity in websharp (or persistence object) is generally the data object passed by value across processes.

For more details, see the http://www.cnblogs.com/foolnet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.