Techbubbles

ASP.NET MVC and Web Forms

This post explores the pros and cons of both ASP.NET Forms and ASP.NET MVC and also discusses why Microsoft released another ASP.NET Framework called ASP.NET MVC. There has been a discussion on choosing the framework for developing the web applications. The following comparisons will help the developers when to choose one or the other.

Benefits of ASP.NET Web Forms 

ASP.NET Web Forms is mature and stable for developing enterprise web applications and it is being supported by many third party controls and tools.

Microsoft basically extended the VB programming model to web forms where developers need not to be a expert in HTML and JavaScript to write effective web applications. To simulate the stateful nature of the desktop development it introduced the features like viewstate and  postbacks.

Key Features of ASP.NET Web Forms are

  • Having a Rich control set and third party support
  • Easy development for Enterprise Web Applications
  • Similar to desktop development and easier for the developers to write code with minimal knowledge of web concepts
  • It is a candidate for RAD Application Development
  • Web forms is a great choice for developing heavily data driven applications.

Drawbacks of Web Forms

  • The Separation of Concerns (SoC) has not been fitting in Web Forms Development.
  • It is hard to do automation testing with ASP.NET Web Forms applications. It is hard to test without initiating the runtime.
  • To achieve statefulness, state of every page stored in viewstate which often rendered on client page as a hidden field.
  • The post back model of ASP.NET page makes it harder for  search engines to rank the page.

Benefits of ASP.NET MVC

Some of the issues that we noticed in web forms can be fixed with ASP.NET MVC model. You can read more about ASP.NET MVC here. Basically it is new framework for developing the ASP.NET Web applications designed from the ground with SoC.

When you develop a MVC application No postbacks are ever required to service a user request. No viewstate is ever required to persist the state of the page.

  • You will be having the total control on HTML, JavaScript and CSS
  • There is a clear separation between your UI and Code
  • Good Candidate for Unit Testing
  • You can easily plug in different UI engines such as nVelocity, XSLT etc.
  • Page size is small and can easily integrated with frameworks like Jquery.
  • It supports TDD

Drawbacks of ASP.NET MVC

  • Not Event Driven, may be difficult for developers who coming from web forms development…
  • No Third party control support.

As an architect or developer, it is important to  understand the structural differences between the frameworks.

Web Forms is a still great choice for building heavily data driven applications and RAD development of the applications. If you want to build web version of win form application then go for web forms.

ASP.NET MVC is better choice if you have a TDD approach for your applications. If you are building the public face websites go for ASP.NET MVC. ASP.NET MVC clearly addressing the drawbacks in webforms. It is not a silver bullet to develop every web application using ASP.NET MVC.

ASP.NET MVC and ASP.NET Web Forms are not competitors and no one is replacing the other. You have to choose one of the frameworks based on your requirements.

Summarizing the above discussion

  • Web Forms is hard to test
  • ASP.NET MVC requires you to manage the HTML in detailed level.
  • ASP.NET MVD not only the way to get SoC
  • MVC was designed with testability in mind.
  • MVC is not anti web form
  • MVC is a better design of code

Again MVC was not created to replace web forms but to partner it.

More about the comparison can be found here 


Share this post :





Related Posts:

%d bloggers like this: