Is there still a place for the decade-old Web Forms web development platform?
I don't know much about the reasons that ultimately brought Microsoft to develop ASP.NET MVC. Maybe it was an attempt to attract new developers by offering a brand-new approach or to evolve the ASP.NET platform toward a more modern design. Fact is, a second and newer framework for web development is available in the .NET platform. Two options imply a choice, and a choice requires information and a bit of analysis.
As a web development platform, Web Forms is fairly old. It was devised about a decade ago in a completely different software age. When Web Forms first appeared, we were coming out of the Active Server Pages era. Web Forms just collected a bunch of ASP best practices and engineered them into a new framework. Postbacks, viewstate, and server controls are all evolutions of common practices of ASP development.
The result was what we today refer to as the Page Controller pattern. According to the pattern, the control of operations for each request belongs to the page object. The page object—specifically the System.Web.UI.Page class—is the central console where the incoming request is processed. Subsequently, the entire request processing is centered on the generation of the page. Processing logic and rendering logic are mixed together to form a sort of black box in which the request comes in and the HTML response comes out. For developers' needs of a decade ago, Web Forms was the right tool at the right time. However, a lot of things have happened since.
In first place, the complexity of applications—including web applications and sites—grew significantly in the past five or six years. This fact raised the need for new software practices such as unit testing. Complexity requires a lot more attention and entails many more features and dependencies. Unit testing is simply the developer's shield against complexity, as it allows developers to check regularly if the team is doing right and if a new feature broke anything else. Unit testing is not simply a testing practice. Unit testing is easier to apply if the code is designed properly with due separation of concerns, is highly cohesive, and has loosely coupled components. That started a sort of silent revolution.
Until late 2008, I was happy enough with Web Forms. I was perfectly aware of its weak points but could nicely work around them with discipline and systematic application of good design principles. When the first previews of ASP.NET MVC came out, I just skimmed over it and kept doing business the usual way. When the previews of ASP.NET MVC turned into a beta product, I started looking into it.
I think that, technically speaking, ASP.NET MVC is far superior to ASP.NET Web Forms. It's because ASP.NET MVC is 10 years younger and because it was designed around an alternative and more modern set of principles and patterns. But is this fact alone a sufficient reason to switch to it?
Testability, separation of concerns, and design are aspects of software, but they affect neither the software' behavior nor how the software addresses a given business scenario. There's no tangible difference between testable that works and un-testable code that works.
In the end, if you're happy today with Web Forms and don't feel alleged limitations of the model as aspects that negatively impact your software, stay with Web Forms. If the characteristics of Web Forms somewhat affect your development process, then consider ASP.NET MVC and evaluate the pros and cons. However, also consider that, at least in one specific scenario, there's a clear and tangible benefit for businesses and customers by choosing ASP.NET MVC. When you need to exercise strict control over the markup, whether to guarantee accessibility or achieve browser compatibility, ASP.NET MVC is the way to go. And once there, you'll experience a superior architecture and the same functionality.
Dino Esposito (email@example.com) an architect at IDesign, specializes mainly in ASP.NET, AJAX, and RIA solutions. Dino co-authored Microsoft .NET: Architecting Applications for the Enterprise (Microsoft Press) and is the author of the just-released Programming ASP.NET MVC 2 (Microsoft Press).