Tuesday, November 30, 2010


You’ve already heard about the weaknesses and limitations in traditional ASP.NET Web Forms from my previous post (http://upulsgamage.blogspot.com/2010/11/whats-wrong-with-aspnet-web-forms.html). That doesn’t mean that Web Forms is dead, though;

Microsoft is keen to remind everyone that the two platforms go forward side by side, equally supported, and both are subject to active, ongoing development. In many ways, your choice between the two is a matter of development philosophy.

• Web Forms takes the view that UIs should be stateful, and to that end adds a
sophisticated abstraction layer on top of HTTP and HTML, using ViewState and postbacks to create the effect of statefulness. This makes it suitable for
drag-anddrop Windows Forms– style development, in which you pull UI widgets onto a canvas and fill in code for their event handlers.

• MVC embraces HTTP’s true stateless nature, working with it rather than
fighting against it. It requires you to understand how web applications actually work; but given that understanding, it provides a simple, powerful, and modern approach to writing web applications with tidy code that’s easier to extend and maintain over time, free of bizarre complications and painful limitations.

There are certainly cases where Web Forms is at least as good as, and probably better than, MVC. The obvious example is small, intranet-type applications that are largely about binding grids directly to database tables or stepping users through a wizard. Since you don’t need to worry about the bandwidth issues that come with ViewState, don’t need to be concerned with search engine optimization, and aren’t bothered about unit testing or long-term maintenance, Web Forms’ drag-and-drop development strengths outweigh its weaknesses.

On the other hand, if you’re writing applications for the public Internet, or larger intranet
applications (e.g., more than a few person-month’s work), you’ll be aiming for fast download speeds and cross-browser compatibility, built with higher-quality, well-architected code suitable for automated testing, in which case MVC will deliver significant advantages for you.

No comments:

Post a Comment