[MVC] MVC and mvc

Source: Internet
Author: User

[MVC] MVC and mvc
1. What is MVC?
MVC (Model-View-Controller) is the framework of View-Model-Controller. When I first saw these concepts, I thought it was a U-D-B? In the View Interface, the model corresponds to this database, and the Controller stores some business logic. Isn't that similar to Layer 3? So naturally think of it as our classic three-tier (U-B-D ).
Since it reminds me of three layers, this so-called new knowledge can be associated with old knowledge, with similarities and differences. In fact, MVC and our three layers are still not the same.
Model: A Model that represents the core of an application (because data is the core) and is part of the data logic of the application;
View: View, used to display data, is the part of the application that processes data display.

Controller: A Controller used to process input. It is a part of an application that processes user interaction.



2. Why use MVC?

1. The same reason why we use Layer 3 and the design pattern is to decouple and.

(1) We can see the traditional WebForm, which contains two files, aspx and aspx. cs, which are in the same WebForm. The HTML language and C # language are combined in a form and cannot be split.





(2) In our MVC program, Controller contains background logic, which calls the layer B interface mentioned in Layer 3. The View layer is ASPX, such as HTML code, model is an intermediate layer.





2. Traditional WebForm has two problems in performance: long response time and high bandwidth consumption.

(1) response time: the time consumed by the server to respond to the request.
The user's request and feedback process is as follows:




Each request is converted to HTML output. Compared with writing HTML code directly, the server response time of such conversion is longer than writing HTML code only.

(2) bandwidth consumption: how much data can be transferred at the same time. Click here for details: http://www.cnblogs.com/powertoolsteam/p/MVC_one.html


Iii. Introduction to the MVC Framework

After MVC is used, the background logic code is placed in the Controller. The View is a simple HTML code, and the Model serves as an intermediate layer. For example, model:







1. user input command 2. Get the controller and pass the USER command to the Model through the Controller. 3. Model for business logic judgment, calling layer D for database access. 4. Select different views based on different business logic and report the results to users.
Summary:The above is some simple understanding of MVC. I thought it was quite simple when I first came into contact with MVC. These are all summarized from the materials I have read and added my own understanding. The specific reasons for M, V, and C are not very clear, and their respective functions are not very clear, it will be easy to use. Next, I will explain how they come from each other? As long as you understand how it comes from, why it is used, and how to use it later is very simple.
In fact, these things are not difficult. They are similar to some of the things we have learned before. It is much easier for us to find the same points and differences for comparison.
I am very familiar with MVC for the first time. Please give me some advice!




Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.