Why MVC is better Than the Web Form


MVC is a new standard design Pattern in Software development World. Knowing how to use ASP.NET MVC is easy.Google can provides thousands of resources through which we can get to know how to configure and program the code.But it is always better to start Why it is used instead of How.

ASP.NET MVC is not a replacement of ASP.NET Web Forms.Microsoft has provide a alternative approach to build a application.

ASP.NET Web Form Problems:

  1. Complexity:HTML and ASP.NET mark up code are used in a Single Page that's why code become very complex.
  2. Tightly Coupled-Aspx page and cs page(code behind file) are tightly coupled.so that we can not work separately.
  3. Unwanted Html and Java Script-when we drag and drop the controls then unwanted html and java script is automatically inserted in our code that's why page become heavier and it takes time to load on browser.
  4. View state-One of the main problems with ASP.NET web forms is the viewstate mechanism, which takes a lot of bandwidth because it serializes all the form inputs and sends it on post commands.
  5. Response Time -for any single events it follows the complete Page Life cycle Events life cycle that's why response time of any ASP.NET application is become more than the MVC application.

Benefits of MVC

Three are several benefits of using MVC are given below.

  1. Separation of Concerns -Separation of Concern is one of the core advantages of ASP.NET MVC . The MVC framework provides a clean separation of the UI , Business Logic , Model or Data. On the other hand we can say it provides Sepration of Program logic from the User Interface.
  2. More Control-The ASP.NET MVC framework provides more control over the HTML , JavaScript and CSS than the traditional Web Forms.
  3. Testability-ASP.NET MVC framework provides better testability of the Web Application and good support for the test driven development too.
  4. Lightweight-ASP.NET MVC framework doesn’t use View State and thus reduces the bandwidth of the requests to an extent.
  5. Full features of ASP.NET-One of the key advantages of using ASP.NET MVC is that it is built on top of ASP.NET framework and hence most of the features of the ASP.NET like membership providers , roles etc can still be used.