The difference between the "Java Architecture Learning" MVC and the three-tier architecture

Source: Internet
Author: User

In fact, the focus of this blog is not to introduce a three-tier architecture, but to focus on MVC and help understand MVC. After studying for so long, MVC finds that there are many misconceptions about it, and today it's time to sort out the MVC.

MVC is Model-view-controller, which m-v-c each representative of what, I think even if I do not list everyone also know the chest. Because too familiar, as we have learned three layers of architecture, the time has long u-b-d each representative what meaning. But what I'm trying to say is, do we know anything about MVC just to stay on the surface?

Ah, or say it, not to say that the heart uncomfortable. It is always known that in MVC, the specific meaning of the representative is as follows:

M--model, model, process data logic parts of your application

V--view, view, is the data display part

C--controller, the controller, is the process of user interaction, which is responsible for reading data from the view and sending data to the model.

after a general understanding of MVC, it is now time to analyze the contents of these three parts. This is the focus of this article Oh. First, compare it with the three-tier architecture. On the internet to find a lot of information, many people think that "MVC is model-view-controller, strictly speaking, these three add up is the three layer of the UI layer in the architecture ." But my understanding may be a little different. The three-tier architecture is relatively distinct in terms of responsibilities, a clear division of labour, and mutual non-intervention in matters beyond their respective mandates, interacting with entities.

And I understand the MVC architecture pattern:

V is the interface display, equivalent to the three-layer structure of the U layer;

The M-Layer model layer, which corresponds to the B-layer, D-layer, and entity layer in the three-tier architecture, because I understand that the M-layer is responsible for the database interaction and the business logic part;

The C-Layer control layer is responsible for getting the request from the browser and then passing the user's brainwashing to the model according to the corresponding requirements, telling the model what to do.

This picture may help us understand MVC better. In addition, it has been mentioned that the C layer does not have any business logic. This point I also have different views, it depends on you less serious, if true seriously,C layer and M layer interaction, M layer is responsible for the main business logic processing, mutual interaction, C layer to know these logic, so the inevitable C layer also need a small part of the business logic to do support. However, you should be aware that the main business logic is still handled in the M layer. Therefore, if not carefully, you can understand the C Layer control layer to obtain the request, the user input instructions and data passed to the M layer for processing, the M layer is responsible for business processing and database interaction; The V layer selects different views according to the business logic and is responsible for displaying them.

Maybe the MVC I know is not the same as the opinion on the Internet, as to what is right and wrong, which will be judged after further study. Next article I will continue the MVC content, discuss Model1 and Model2, please look forward to it!

The difference between the "Java Architecture Learning" MVC and the three-tier architecture

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.