Understanding of Layer 3 and MVC

Source: Internet
Author: User

The three-tier architecture is MVC!

At first, the teacher always said three layers of MVC, three layers of MVC Architecture ......

At the beginning, I came up with the concept that three layers are MVC, and MVC is a three-layer architecture. It is also reasonable to think about it. It is "three ". MVC is a three-letter architecture, and the three-layer architecture is also "three. Then it took a long time to get "wrong.

The three-tier architecture is definitely not MVC !!

After learning J2EE, I found that the teacher said something wrong. The MVC and layer-3 architecture are not one thing. The three-tier architecture consists of the interface layer (UI) business logic layer (BLL) and data access layer (DAL), while MVC is the model layer (m) interface layer (view) and the control layer (Controller), and they do not correspond to each other.

If they need to be matched, the UI in the layer-3 architecture corresponds to the view (JSP) in MVC, which is used to display and obtain the interface data; the bll layer and Dal layer in the three-layer architecture correspond to the model (JavaBean) layer in MVC, which is used to process the data transmitted by the upper layer and the data obtained from the database; the Controller (servlet) in MVC) it can be regarded as a part of the UI in a three-tier architecture at most, so we often say servlet.

As shown in:


I suddenly felt that the world was clear and I had a deep understanding of the hierarchy.

In fact, the three-tier architecture and MVC are still a thing !!!

Over the past few days, I have been thinking about the relationship between the three-layer architecture and MVC. Why did the teacher put it together at first? Then I suddenly realized that the three layers of architecture are the same as those of MVC !!! What we see is different on the surface. What is the core?

Answer: stratified, decoupled!

From the perspective of decoupling, the three-layer architecture and MVC are actually consistent, but the Division methods are different, as shown in the figure above. From this point, they can be said to be something. This is equivalent to seeing steamed buns and noodles. On the surface, they are different (note only the surface), but their core is the same. They are all noodles ......

The process of learning knowledge is like that of old ox, which requires constant deepening of understanding, so that we can truly understand it.

The understanding of things is from emotional to rational, and is deepened step by step. The deepening of each step may overturn the previous one, and may agree with the previous one more. If we overturn the old one, it means that the understanding of this thing has changed. However, if we approve of the old one, it does not mean that our views have not changed, on the surface, the kernel is always the same. In the beginning, the three-layer architecture and MVC were regarded as one thing at the end, but the layers of understanding were definitely different.

I don't know if I will overturn my opinion again in the future. I can only say that each overturn represents progress and a deeper understanding, so I hope to deny myself next time.

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.