Introduction to MVC Summary--MVC and differences with WebForm

Source: Internet
Author: User

    • What is MVC

MVC (Model-view-controller, model-View-controller mode) is used to represent a software architecture pattern. It divides the software system into three basic parts: model, view, and controller. Since it is a "model", in my opinion, it is the same as the design pattern, decoupling, encapsulation, the implementation of software flexibility, reuse and expansion.


I understand MVC very clearly, if you want to put MVC and three layer together, I think the view and controller more like the UI layer, model can have bll,dal,entity, just personal understanding.

    • Why use MVC

In web development, the interface changes frequently as requirements change, and business logic changes little. That is, the change of the interface display > The change of business logic.

    • and WebForm Difference
page display and logical separation:

originally built an ASP. NET Web Forms Application :


The ASPX page of the page corresponds to a Aspx.cs class, which is coupled, and if we want to get the value from the page's server control, we need to write the control name in its corresponding CS file. So when the interface changes, the code also has to change, or you have to create a new form, copy the invariant parts.

In MVC:

The. aspx file and the CS file are separated, a controller corresponds to a set of pages, for example, the index page changes, we can create a new page index, the original deleted, and the controller in the index method of the logic does not need to change; You can also build a page with a different name, such as Myindex, and then in the original index method, modify return view, by default, the returned view is the same name as the method, but allows different views to be returned. However, it does not conform to the opening and shutting principle.

Access method:

WebForm is to find a specific page in the physical address of the server

MVC is looking for a method under a controller

Other:

In WebForm, for a page, we can right-click to browse the page, or this is the start item, but in MVC we are going to browse a page and only enter the address in the Address bar. and setting the startup item, you need to set it in the route in Global.asax.

In WebForm, we drag controls directly onto the page, and in MVC we need to hand-write HTML code, but in MVC there are htmlhelper, which is much easier.

    • Summarize

This article gives a brief introduction to MVC, and the difference between it and WebForm. Their understanding of the two, but also only the surface of things, by looking at other people's blog, understand the advantages and disadvantages of each of them, the following links, for your reference.

Http://www.cnblogs.com/wlb/archive/2009/12/07/1618954.html


Introduction to MVC Summary--MVC and differences with WebForm

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.