11.18(eleven point one eight)

三层架构的原理及作用_三层架构怎么用—-优点1、开发人员可以只关注整个结构中的其中某一层;

2、可以很容易的用新的实现来替换原有层次的实现;

3、可以降低层与层之间的依赖;

4、有利于标准化;

5、利于各层逻辑的复用。

三层架构的原理及作用_三层架构怎么用—-缺点1、降低了系统的性能。如果不采用分层式结构,很多业务可以直接造访数据库,以此获取相应的数据,如今却必须通过中间层来完成。

2、有时会导致级联的修改。这种修改尤其体现在自上而下的方向。如果在表示层中需要增加一个功能,为保证其设计符合分层式结构,可能需要在相应的业务逻辑层和数据访问层中都增加相应的代码。

3、增加了开发成本。三层架构是一种软件架构(software architecture) ,是一种分层结构。在软件体系架构设计中,分层式结构是最常见,也是最重要的一种结构,它将整个业务应用从上到下划分为:表示层(User Interface layer)、业务逻辑层(Business Logic Layer)、数据访问层(Data access layer)。三层结构的出现的目的是为了解决B/S应用的高内聚低耦合。

表示层:又称表现层UI,位于三层构架的最上层,与用户直接接触,主要是B/S信息系统中的Web浏览页面。主要功能是实现系统数据的传入与输出,将数据传送到业务逻辑层中进行数据处理,业务逻辑层处理后会将处理结果反馈到表示层中。

业务逻辑层:位于表示层与数据层中间位置,是表示层与数据层的桥梁,先对接收数据进行逻辑处理,再调用数据访问层实现数据的修改、获取、删除等功能,并将处理结果反馈到表示层中。

数据访问层:主要是对数据库的进行操作,实现数据的增加、删除、修改、查询等操作,并将操作结果反馈到业务逻辑层,具体为业务逻辑层或表示层提供数据服务。

————————

Principle and function of three-tier architecture_ How to use the three-tier architecture —- advantages 1. Developers can only focus on one layer of the whole structure;

2. You can easily replace the original level of implementation with a new implementation;

3. It can reduce the dependence between layers;

4. Conducive to standardization;

5. It is conducive to the reuse of logic in each layer.

Principle and function of three-tier architecture_ How to use the three-tier architecture —- disadvantages 1. It reduces the performance of the system. If the hierarchical structure is not adopted, many businesses can directly visit the database to obtain the corresponding data, but now they must be completed through the middle tier.

2. Sometimes it leads to cascading modifications. This change is particularly reflected in the top-down direction. If a function needs to be added in the presentation layer, in order to ensure that its design conforms to the hierarchical structure, it may be necessary to add corresponding code in the corresponding business logic layer and data access layer.

3. Increased development costs. The three-tier architecture is a software architecture and a hierarchical structure. In software architecture design, hierarchical structure is the most common and important structure. It divides the whole business application from top to bottom into user interface layer, business logic layer and data access layer. The purpose of three-layer structure is to solve the high cohesion and low coupling of B / s applications.

Presentation layer: also known as presentation layer UI, it is located at the top of the three-tier architecture and has direct contact with users, mainly web browsing pages in B / s information system. The main function is to realize the input and output of system data, transfer the data to the business logic layer for data processing, and the business logic layer will feed back the processing results to the presentation layer after processing.

Business logic layer: located in the middle of the presentation layer and the data layer, it is the bridge between the presentation layer and the data layer. First, the received data is logically processed, and then the data access layer is called to realize the functions of data modification, acquisition and deletion, and the processing results are fed back to the presentation layer.

Data access layer: it mainly operates the database, realizes the operations of data addition, deletion, modification and query, and feeds back the operation results to the business logic layer, specifically providing data services for the business logic layer or presentation layer.