Last year at the fall 2008 DevConnections conference, I was very happy to hear Scott Guthrie providing a clear message about web forms vs. MVC in ASP.NET 4.0.
Now, I am seeing something that is new for MSDN Documentation, not only similar clarity but actual guidance on when Microsoft suggests to use one over the other.
You’ll find this in two places.
First, in the ASP.NET MVC Overview topic. In this document, their is a list of advantages of MVC and a list of advantages of web forms apps.
Next, in the topic titled Compatibility of ASP.NET Web Forms and ASP.NET MVC, there is a short list of strengths of web forms and another of the strengths of MVC. Following this are short lists of asp.net features that are compatible with MVC and then those that are incompatible with MVC.
Key from the overview doc:
Line of Business web apps
- Web Forms “preserves state over HTTP, which benefits line-of-business Web application development.”
Web Forms for RAD and MVC for granular control??
- Web Forms “works well for small teams of Web developers and designers who want to take advantage of the large number of components available for rapid application development.”
- Web Forms “in general … is less complex for application development".”
- MVC is for “large teams of developers and for Web designers who need a high degree of control over the application behavior.
Test Driven Development
- MVC “provides better support for test-driven development (TDD).”
The bottom line?
There’s a way of reading the documentation that might cause you to summarize that Web Forms is for RAD development and MVC is for serious application development. Does that mean the line of business apps do not belong on the web because they require us to use session state and any web developer in his/her right mind would not want to incorporate session state in their applications? Well, the problems that pop up when you start considering session state on distributed servers suggests that the answer to this question is “yes”. But ASP.NET developers never really had an option before.
Remember that ASP.NET was created so that windows developers could write web apps, and that’s why things like session state and view state are so critical in web forms. They are potentially cumbersome to deal with and easily misused.
MVC goes back to a more purist form of web development which is state-less. But a stateless environment doesn’t lend itself well to having large units of work which we have gotten used to in LOB apps.
On the other hand, even the documentation says that you will have a lot more work ahead of you if you want to work with MVC. First of all, there’s a major paradigm shift from web forms, especially for those who don’t come from a web background prior to ASP.NET.
Where does this leave me?
This leaves me much more curious about MVC and thinking that I may shift my focus of attempting to design serious web app that use Entity Framework from web forms to MVC. It also leaves me nervous since it also might mean a major last minute change to one of my DevConnections presentations this week. It will be hard because leveraging MVC to demo another technology depends on the audience having a general understanding of MVC which is not something that I can expect at all. Now if my session were 4 or 5 hours long, it would be a different story.