Shift from two-tier design thinking to three-storey design thinking

Source: Internet
Author: User

The traditional two-tier programming mindset is this


The design of the interface, the design of the business logic, and the link of the database are all implemented together.

Overall, the two-tier programming has the following characteristics

    • Database access and user-type judgment logic are implemented together.

    • The user interface layer invokes the data access implementation directly.

    • The user interface layer invokes the data access implementation directly.

  • This structure has many limitations, such as: Once the user's needs change, the application needs to make a lot of changes, and even need to re-development, to the maintenance and upgrading of the system has brought great inconvenience, the user interface layer directly access to the database, will bring a lot of security risks. In order to overcome the limitations of two-layer structure, three-layer structure is proposed.


    The so-called three-tier architecture is the addition of a "middle tier", also called a component layer, between the client and the database. Here the three-layer system, not refers to the physical three layer, not simply placed three machines is three-tier architecture, also not only B/s application is the three-tier architecture, three layer refers to the logic of the three layer, even if the three layers placed on a machine.


    This is the three-story structure.
    user interface layer, business logic layer, data access layer this is layer three. But what do you see as a data-object model?
    This blog can be consulted. http://www.cnblogs.com/sdjxcolin/archive/2008/12/12/1353780.html
    Of course, when doing the project, only three layer is not finished the basic project, but also need to add dependencies, each layer needs to add to each layer between the dependencies, which is learning three layers of the most basic operation. The reference relationships added are as follows
      1. Adds a dependency of the presentation layer on the business Logic layer , the data Access layer , and the data object model layer .

      2. Add the business Logic Layer 's dependency on the data Access layer and the data object model layer .

      3. Adds a dependency of the data Access layer on the data object model layer .

    The three-storey design is the beginning of our formal path to programming, and we need to understand it well. The three layer, though written in more code, has many advantages:

    The data access layer is only responsible for providing the original raw data, do not need to understand the business logic, the business logic layer calls the method provided by the data access layer to customize some of the business logic, the data processing, itself does not need to understand the implementation of the data access layer;

    The advantage of three-layer structure is that it is necessary to change a function or a process in the business logic layer, and to improve the reusability of the Code, and to facilitate the cooperation between different levels of developers, as long as there is a certain interface standard, it is not necessary to move to the whole program modification for the small changes in the business logic. Eventually the pieces are stitched together to form the final application.



  • Shift from two-tier design thinking to three-storey design thinking

    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.