Three-tier model

Source: Internet
Author: User

The UI, logic, and data layer-3 mode is the most classic solution for large-scale data processing projects.

My opinion is as follows:

The UI Layer uses the logic layer, while the logic layer uses the data layer.

That is, UI depends on logic and logic depends on data. From the object-oriented perspective, the data layer is at the top of the abstraction.

The object-oriented principle is that the top of the abstract should not be changed as much as possible, otherwise the bottom layer of the abstract must be modified. The underlying layer can be changed, and the top layer does not need to be changed.

In this layer-3 mode, the data layer is the least changeable.

However, in the post-Maintenance of the actual project, we will never modify the UI without the end, but the user's needs have changed. The main level of the change is the change of the data layer. In this reality, is the layer-3 Model meaningless?

It should be said that this reality will lead to the loss of many structural advantages of the three-tier model, but the three-tier model will help program object-oriented.After the internal structure of the data layer is improved, there are two advantages: 1. Separation from physical storage; 2. Data entity LocalizationFor example, the instructor and student data entities only modify the instructor part and only affect the logic and UI of the dependent instructor part, without affecting the student part.

The implementation of the three-layer mode helps the development from top to bottom, from abstraction to concrete, from the data layer to the UI Layer, reduce repeated modifications caused by confusion in the development direction.

Other supplements:

Changes in the data layer here refer to changes in the data structure, rather than changes in details such as storage. Because the storage details are the tasks at the data layer: the tasks at the data layer abstract the data storage location to provide a unified data structure for other parts. From the object-oriented perspective, changes in the data layer refer to changes in interfaces rather than changes in implementations.

Layer-3 mode, a common requirement is to separate the control relationship between the UI Layer and the data layer, and use the logic layer as the bridge for interaction. However, it is important to note that the control relation is mentioned here, rather than the so-called dependency relation of object-oriented language. The dependency of the UI Layer on the data layer is natural. Although this direct dependency can be reduced in a sense, there is no need to deliberately do this.

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.