Differences between MVC and L3 Architecture

Source: Internet
Author: User

This article is translated from Zhao Dandan's column "answers to the three-tier architecture and MVC Mysteries"
 We usually confuse the three-tier architecture with MVC, but it is not a concept. Next I will reveal some of the truth I know.
 

First, they are not a concept at all.

    
A three-tier architecture is a hierarchical software architecture design that can be applied to any project.
MVC is a design pattern that determines whether it is applicable to a project based on the specific needs of the project.
 
What is the difference between the architecture and the design model?
Starting from taking over a project, we first need to design the architecture. Generally, we adopt a layered architecture design, that is, our three-tier architecture.
 
Then, after determining the architecture, we will consider whether we need to apply some design patterns based on the specific needs of the project, such as whether to apply our MVC pattern and abstract factory pattern. (Here we can see that MVC and the three-tier architecture are not at the same level, and the design pattern such as abstract factory is the same)
 
Finally, after the pattern is determined, it is our specific implementation. (Of course, a project not only considers these issues, but I just want to explain the differences between the two and omit other problems)
 
Second, they are divided at different levels.
The three-tier architecture divides the entire project into: presentation layer (UI), business logic layer (BLL), and data access layer (DAL ).
MVC is model, view, and controller ).
 
Let's take a look at their differences and relationships:
         
Through this figure, we can know that V is the UI, C is the Bll, and m is the Dal.
The MVC we usually see is also based on the three-tier architecture of the application, that is, the model layer is further layered. If the model is no longer divided, it makes little sense to use MVC.
         
Then, they have different purposes.
The three-layer architecture focuses on "High Cohesion and low coupling", that is, decoupling.
The purpose of MVC is to achieve the functional division of the web system, that is, the division of duties.
In fact, division of duties is also decoupled, but the three layers focus on the overall decoupling, while MVC focuses on the decoupling of web systems, that is, the decoupling of JSP and servlet.
 
Finally, why are we confused?
Since there are so many differences between the two, why do we always confuse them? Below I will list several reasons why we often confuse them:
    1. Both are "Three Layers ".
This is the most confusing reason for beginners. One is UI, BLL, Dal, and the other is view, Controller, and model. Aren't they all three layers?
Although they are all "Three Layers" (not necessarily three layers, but also multiple layers), they are divided differently. You can see the difference from the figure above.
 
    2. MVC is always accompanied by a three-tier architecture.
This is what I have repeatedly stressed above. We generally consider using (or not) a layer-3 architecture and decide whether to use MVC Based on specific requirements, as we often say, MVC is always accompanied by a three-tier architecture, so everyone will always think that MVC is a three-tier architecture, and that the three-tier architecture is MVC. However, they both come together.
 
    3. All are in layers, that is, all are in decoupling.
As mentioned above, their purposes are also discussed. Although they have different focuses, their overall purpose is the same, all for decoupling. For Beginners, I don't know what the two focuses on.

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.