5/05/2011

which is better ? ASP.NET MVC or WebForms : How to choose between MVC and Webforms ?

  • ASP.NET Web Forms vs MVC ! 
  • What is the difference between ASP.NET WebForms and ASP.NET MVC ? 
  • When should I really choose MVC vs when should I choose webforms !
These are questions that normally run in the mind of any .NET developer in the recent times ( Confusing them what to learn ). Well both are used to build the same stuff and both have enough capabilities to build applications except that the way they are developed, tested and maintained is different. If some so called expert comes to you and says both are used to build different stuff , then it could very well  be that he is not able to understand things correctly.

Let me present you a small table that tells you the differences between the both and simplify your queries . The green ones are the advantages and red ones can not be..

ASP.NET MVC
ASP.NET Web Forms
More control over HTML that is rendered to browser which means you can really generate cleaner HTML
Don’t offer such a fine control over the HTML that is rendered and most of the it gets dirtier that we know.
Superior separation between UI and code
UI and logic coupled with code making it complex
Supports Multiple View Engines. Reuse your model/ Controller and plug it to a different view engine.
A option to forget about :). Switching between views with lot of things ( Master page, user control , theme ) is not a cake walk.
No Viewstate meaning a smaller page size. Unavailability of viewstate has its disadvantage too.
The more persistent controls you need, the more your view state will be and hence your page size too.
Allows end to end Test driven development (TDD), easy implementation of Mocking.
Not so straight forward to do unit tests for everything especially for the logic tightly coupled with your UI.
Easy integration with client side libraries like Jquery
Integration is possible but switching will be a bit difficult.
Development does need more effort. Don’t expect it to happen in same pace as Web Forms.
Very Suitable for RAD (Rapid Application Development). Build small applications and quick prototypes. Ease of development for heavy LOB applications.
MVC is a complete new way of doing web design and development. It basically gives a abstraction on both.
Windows Form Style development. (Any one can do development).  Feel at ease with drag, drop and clicks .Great designer support.
A lot of training and required for the developers to divert their mindset from conventional event driven programming. Frameworks and other things have still to evolve.
Greater visual studio support, Availability of resources and developers, Availability of third party controls.



So If we really look into the above analysis, ASP.NET web forms is a bit complex with lot of things ( ViewState, Postback, Page lifecycle, Data Binding ) having to be put in one place. The more complex things you start to make, the more complex your pages will start to become. Where as MVC is more of trying to loosely couple your HTML (VIEW) with the rest of code.

MVC does help you in doing a TDD but that does not mean you cant write your applications with out unit tests. Keeping the myths apart, When do you really need to choose MVC or Web Forms ?


Choose ASP.NET MVC
Choose ASP.NET Web Forms
  • More Test Driven Development (When you have to  validate everything you write )
  • More Control on HTML and need for separation ( Designing vs Code)
  • New large application (Especially build and evolve in long term)
·         Rapid Application Development ( RAD ) and less time to Market applications
·         Winforms like programming interface  ( Availability of Developers )
·         Heavy Data driven applications
·         Existing Web Forms application need not be migrated to MVC



Need more asp.net tips and tricks ? For more Subscribe here or click here to get updates via email

7 comments:

The above information provided was helpful to some extend

Well I guess that it depends of the programmer, I'm not a programmer, but I can tell that I like good graphic stuff for video, you know.
Thanks, nice article.

I'll probably go for ASP.NET MVC. If you want to make sure your website is good, you need to conduct testing. It's also important to have a control on the codes.

dentist website design

Retailers know that they have to do http://www.mbtschuheshops.com/mbt-schuhe.html what they can to stay in business during this economic meltdown. Some people may shy away from MBT shoes clearance items, but most will find these styles more than satisfying to meet their http://www.mbtschuheshops.com/mbt-frauen-schuhe/mbt-frauen-stiefel.html fitness requirements as well as saving http://monsterbeats-uksale.blogspot.com/ a substantial amount of money

Retailers know that they have to do http://www.mbtschuheshops.com/mbt-schuhe.html what they can to stay in business during this economic meltdown. Some people may shy away from MBT shoes clearance items, but most will find these styles more than satisfying to meet their http://www.mbtschuheshops.com/mbt-frauen-schuhe/mbt-frauen-stiefel.html fitness requirements as well as saving http://monsterbeats-uksale.blogspot.com/ a substantial amount of money

Retailers know Mbt Schuhe Outlet that they have to do what they MBT Sandalen can to stay in business during this economic MBT Damen Schuhe meltdown. Some people may shy away from MBT shoes clearance Mbt Outlet items, but most will find these styles more than satisfying to meet their fitness requirements as well as MBT Damen Sandalen Schuhe saving a substantial amount monsterbeats-uksale of money

Retailers know Mbt Schuhe Outlet that they have to do what they MBT Sandalen can to stay in business during this economic MBT Damen Schuhe meltdown. Some people may shy away from MBT shoes clearance Mbt Outlet items, but most will find these styles more than satisfying to meet their fitness requirements as well as MBT Damen Sandalen Schuhe saving a substantial amount monsterbeats-uksale of money

Post a Comment