Three-tier architecture and MVC pattern

Source: Internet
Author: User

1, three layer architecture

The three-tier architecture (3-tier application) typically has a three-tier architecture that divides the entire business application into: The presentation layer (UI), the Business Logic layer (BLL), the data Access Layer (DAL). The purpose of distinguishing hierarchy is to "high cohesion, low coupling" thought.

1, the presentation layer (UI): Popular speaking is to show the user interface, that is, users in the use of a system when he saw the gains.

2, Business Logic Layer (BLL): The operation of the specific problem, it can be said that the operation of the data layer, the data business logic processing.

3, data access Layer (DAL): This layer of transactions directly manipulate the database, for data additions, deletions, modifications, updates, lookups and so on.


Representation of the implementation of the performance layer is the struts framework, the business layer implementation of the representative works is spring, the persistence layer of the implementation of the representative works is hibernate.

As an example:

The persistence layer is removed from the persistent library-10.

The business layer is translated into 10 degrees Celsius according to a certain logic (here we take the logic of the temperature for example).

The presentation layer appears to the user "gee, it's cold today!" ”。

The layer is the equivalent of a black box, and we don't have to know how it's done inside, just know how to call it. Each layer deals only with two layers adjacent to the top and bottom. When a layer of internal change occurs due to technological changes, as long as the interface is unchanged, the other layers do not have to make any changes. Flexibility increases after layering, and facilitates team development.


2. MVC

M: Model: The core function of the application to manage the data and values used in this module;

V (view) View: The view provides a demonstration of the model, how the management model is displayed to the user, and it is the appearance of the application;

C (Controller) Controller: Responds to user input, manages user and view interactions, and is a hub for connecting models and views.

MVC is used to decouple the Web (UI) layer from responsibility


3, three-tier architecture and MVC differences and linkages

MVC is Model-view-controller, strictly speaking, these three add up is the three layer of the UI layer in the architecture, that is, MVC in the three-tier architecture of the UI layer again differentiated, divided into the controller, view, entity three parts, the controller to complete the page logic, Through the entity to complete the call with the interface layer, and the C layer directly with the BLL in the three layer dialogue.


MVC can be a presentation layer in layer three, which belongs to the presentation layer. Layer three and MVC can coexist.

Layer three is based on the business logic, and MVC is based on the page to divide.

MVC is mainly used for the presentation layer, 3 layer is mainly used for architecture, 3 layer is generally the presentation layer, the middle tier, the data layer, wherein the presentation layer can be divided into M, V, C, (Model View Controller) models-View-controller


MVC is the expression pattern (Presentation pattern)

Three-tier architecture is a typical architectural pattern (Architecture pattern)

The layered pattern of the three-tier architecture is a typical up-down relationship, with the upper layer dependent on the lower. But MVC, as a performance model, does not exist in the upper and lower relations, but is a collaborative relationship. Even if MVC is used as an architectural pattern, it is not a layered pattern. MVC and the three-tier architecture are basically not comparable and are applied to different areas of technology.




Three-tier architecture and MVC pattern

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.