Enterprise Application Architecture Model-layered

Source: Internet
Author: User

In the hierarchical organization mode of the system, the upper layer uses various services defined by the lower layer through interfaces, and the lower layer knows nothing about the upper layer. Each layer hides the details of its lower layer from its upper layer, so the second layer does not need to know the details of the second layer.

 

Advantages of layering:

1. You can focus on understanding a layer without having to know more about other layers;

2. The specific implementation of a layer can be replaced, as long as the services (interfaces) provided before and after are the same;

3. The dependency between layers can be minimized. If Layer 3 changes, as long as the Layer 3 remains unchanged, no change is required for both the Layer 3 and above;

4. layering is conducive to standardization. There is no need to say that industry standards can be standardized even within enterprises and projects;

5. For a well-established hierarchy, its upper-layer calls and forms of presentation can be diversified.

Disadvantages of layering:

1. hierarchies cannot encapsulate all things, sometimes causing cascade modifications. For example, to add a display data item on the interface, you need to add a field to the database, and each layer in the middle will change accordingly;

2. Too many layers may affect performance.

 

The most difficult issue in layering is to determine which layers to establish and the functional responsibilities of each layer.

The two commonly used words in layering are layer and tier. Generally, tier is considered as physical separation, while layer is more representative of logical separation.

 

There are three basic layers: presentation layer, domain layer, and data source layer.

1. The presentation layer is the interface for the system to provide external services. It usually processes interactions between users and software, displays information to users, and translates the information obtained from users into various operations at the domain layer or data source layer; it may also provide services for other systems or software, such as WebService;

2. The data source layer is an interface for the system to obtain services from the outside world. It mainly processes interaction with other systems, including transaction monitors, other applications, and message systems, and databases;

3. The Domain Layer (Business Layer) processes business-related logic and serves as a bridge between the presentation layer and the data source layer. Its primary responsibilities include data verification and calculation, as well as providing services for the presentation layer and invoking services at the data source layer.

 

How to layer depends on the complexity of the application:

1. Simple Applications can be layered at the subprogram level. Different subprograms process interface operations, data access, and data processing respectively;

2. For a slightly complex application, layers can be performed at the class level;

3. In more complex cases, layers are required at the module level.

The general principle of layered dependency: The Domain Layer and Data Source layer must not depend on the presentation layer!

It is difficult to distinguish the domain logic. The available test method is: consider adding a completely different new layer to the system, consider replacing the data source format, etc, put the processing logic that will change dramatically into the domain layer.

 

During system deployment, you must consider how to deploy layers. Factors to consider include system responsiveness, network connection, data synchronization, client upgrade and maintenance, and browser compatibility.

Complex supercharger to be defended against during system development: distributed processing, explicit multithreading, fan type differences, multi-platform collaborative development, and extreme performance requirements.

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.