Talking about the. NET, C # Three-tier architecture (self-Summary ),

Source: Internet
Author: User

Talking about the. NET, C # Three-tier architecture (self-Summary ),

 L3 Architecture

  • Common architecture:
 
  • There are 23 common design modes in development:
There are five creation modes: Factory method mode, abstract factory mode, Singleton mode, builder mode, and prototype mode. There are seven structural modes: adapter mode, decorator mode, proxy mode, appearance mode, bridging mode, combination mode, and meta mode. 11 behavior models: rule mode, template method mode, observer mode, iteration sub-mode, responsibility chain mode, command mode, memorandum mode, state mode, visitor mode, intermediary mode, interpreter mode.
  • Six principles of design patterns
1. Principle of Open/closed 2. Principle of Li's replacement 3. Principle of dependency inversion 4. Principle of interface isolation 5. Principle of dimit (principle of least knowledge) 6. Principle of merging and reuse
  • Interaction between programs
1. reference namespace 2. file (IO, servile), file stream, serialization 3. DB database 4. web Request (Ajax) (Socket) (HTTPRequest submit method: get, post) link 1 (Baidu encyclopedia): https://baike.baidu.com/item/%E4%B8%89%E5%B1%82%E6%9E%B6%E6%9E%84/11031448? Fr = aladdin connection 2 (mandatory): bytes 1. concept:A three-tier architecture usually divides the entire business application:
  • User Interface layer)
  • Business Logic Layer (BLL)
  • Data access layer (DAL)
The purpose of hierarchy differentiation is to "High Cohesion and low coupling". Any layer change will not affect the other layer !!! 1: Data access layer: It mainly refers to the operation layer of non-raw data and database operations. Specifically, it provides data services for the business logic layer or presentation layer. 2: Business logic layer: Mainly for specific operations, data business logic processing 3: Interface Layer: Display layer, interactive interface, mainly indicating the WEB mode, or the winform mode. 2. High Cohesion and low coupling: Concept Coupling:It is also called inter-block connection. A measure of the closeness between modules in the software system structure. The closer the relationship between modules, the stronger the coupling, and the poorer the module independence. The coupling between modules depends on the complexity of Inter-module interfaces, call methods, and transmitted information. Cohesion:It is also called intra-block contact. A measurement of the module's functional strength, that is, a measurement of the closeness of each element in a module. If the elements in a module (between language names and between program segments) are closely related, the higher the cohesion. Coupling:Measure the degree of interconnection between different modules in a software architecture. Low CouplingThe rough understanding is: a complete system, between modules, as far as possible to make it independent. High CohesionA software module is composed of highly correlated Code and is responsible for only one task, that is, a single responsibility principle. 3. Advantages and Disadvantages: Advantages1. developers can focus only on one layer of the entire structure. 2. They can easily replace the original implementation with new implementations; 3. It can reduce the dependency between layers; 4. It is conducive to standardization; 5. It is conducive to the reuse of logic at each layer. 6. clearer structure 7. reduced maintenance costs and maintenance time Disadvantages1. 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, but now 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 its 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. Increased development costs. 4. Entity layer (Entity): (view join 2)  Entity (Entity layer): It does not belong to any layer in the three layers, but it is an essential layer of Entity Library (Model). It mainly Stores Table fields in the database. 4. Data Transmission (unidirectional) between each layer (UI-> BLL-> DAL) is transmitted by variables or entities as parameters. In this way, links between three layers are constructed, the function is implemented. However, for a large amount of data, it is complicated to use variables for parameters, because there are too many parameters and it is easy to mix them up. For example, I want to transmit employee information to lower layers, including employee ID, name, age, gender, salary .... if we use variables as parameters, there will be a lot of parameters in our method, and it is very likely that we will mix the parameters during use. At this time, if you use an object as a parameter, it will be very convenient. You do not need to consider the parameter matching problem. You can use the attribute in the object for direct use. This also improves the efficiency. (Note: Why does it mean that each data table corresponds to an object for the time being ?? A: We all know that our system is designed to provide services to users. Users don't care how your system works in the background. Users only care about whether the software is easy to use, whether the interface meets your own needs. Users can easily add, delete, modify, and query data on the interface, so the database must also have corresponding additions, deletions, modifications, and queries, the specific operation object for addition, deletion, modification, and query is the data in the database. To put it bluntly, it is the field in the table. Therefore, each data table is regarded as an entity class, and the attributes encapsulated by the entity class correspond to fields in the table. In this way, when the entity runs between three layers, this allows you to add, delete, modify, and query data. In summary, the dependency between the Layer 3 and the entity layer is as follows: 5. Code:Three-tier architecture simple code: http://blog.csdn.net/zhgl7688/article/details/43669463#comments

Related Article

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.