MVC is the first knowledge of "MVC"

Source: Internet
Author: User

first, what is MVC?
MVC (Model-view-controller), the frame of view-model-controller, when I first saw these concepts, I thought it was u-d-b? The view interface, the model is corresponding to the database, and the controller is the storage of some business logic, this is not like three layers? So it's natural to think of our classic three-storey (u-b-d).
since I can think of the three layer, the so-called new knowledge is can be linked with the old knowledge, there are similarities, there are different points. In fact, MVC is not the same as our three layer.
model: Models, which represent the core of the application (because the data is the core), are the parts of the application data logic;
view: Views, which are used to display data, are the parts of the application that process data display.

Controller: Controllers, used to process input, are part of the application that handles user interaction.



second, why use MVC?

1, with why we use the three layer, the use of design patterns for the same reason, is to understand the coupling and.

(1) We look at the traditional WebForm form, which contains two files, one is ASPX, the other is aspx.cs, and they are under the same WebForm form. HTML language, C # language is in a form, there is no way to split.





(2) and in our MVC program, the controller contains the background logic, called in our three layer of the B-layer interface, the view layer is ASPX, such as HTML code, model is a middle layer.





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

(1) Response time: The server is time-consuming to respond to requests.
the user's request and feedback process such as:




each time we request it, it is converted to HTML output. Instead of writing HTML code directly, the server response time for this transformation is longer than it would be to write pure HTML code.

(2) Bandwidth consumption: How much data can be transmitted at the same time. For more information, please click here:http://www.cnblogs.com/powertoolsteam/p/MVC_one.html


Iii. Introduction to the MVC framework

after using MVC, the background logic code is placed in the controller controllers, the view is simple HTML code, and the model as a middle layer. such as model:







1. User input Instruction2, obtain the controller, through the controller to pass the user instructions to model models. 3, model models, business logic judgment, call D layer, access to the database operations. 4, according to different business logic, select different views view, and feedback the results to the user.
Summary: The above is some simple understanding of MVC, just beginning to contact with MVC, think it is quite simple. These are from their own reading of the information, coupled with their own understanding of the summary, the specific why to have m,v, and C is not very clear, their respective role is not particularly clear, just a simple understanding, will be simple to use. And then it's going to be a little bit inquisitive, how do they come from each other? As long as you understand how it came about, why use it, and how to use it in the back is particularly simple.
In fact, these things are not difficult, and we have learned something similar, we find the same point and different points of comparison is much easier.
First contact with MVC, there is an unfortunate place to understand, but also please give us a lot of advice!




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MVC is the first knowledge of "MVC"

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.