As users, we enjoy the experience offered by certain web sites more than others. Some of our favorite sites include Google maps and basecamphq.com. What does it take to provide such a user experience? This document examines aspects of interest when attempting such a task using the two web-development frameworks from Microsoft: Web Forms and ASP.NET MVC. Please note: this is a very short version of the original white paper. The full text with much more technical detail is available here -> Read the full white paper.
Ajax allowed for the selective refresh of sections of a Web page. With Web Forms, even when the user interface refresh was selective, the actual cycle of server-side post-back and server lifecycle events was required to be complete since the server-side abstraction model depended on it. This is not the most optimal way to implement Ajax.
With ASP.NET MVC there is no real abstraction of the details. HTTP is a stateless protocol. Ajax calls are trivial to implement. They perform exactly as advertised and can be selectively processed on the server.
Separation of Concerns: User Interface code and Business Logic
The Model-View-Controller pattern is a very simple pattern that advocates the clear separation of responsibilities between the model (data), controller (logic & orchestration) and the view (presentation). It has been observed to help produce more maintainable, structured applications.
A key issue with Web Forms is that the controller and view (and at times even the model) are implemented together in the Web Forms page (or server-side control). This tied key parts of the application’s logic into the view, making the application hard to maintain.
ASP.NET MVC takes the separation between the view and the controller very seriously. The controller orchestrates interaction between the model and the view. There is no coupling between the view and the model or the view and the controller.
Web Forms applications can use jQuery, but not in a very optimal manner. Web Forms controls act as self-contained units and produce an extensive amount of intricate markup making it hard to target such elements from jQuery.
With ASP.NET MVC, developers have complete control over the markup. This makes it the norm to have HTML that is jQuery friendly.
Controls written for the ASP.NET MVC framework (typically) respect this model and attach behavior on the client-side, keeping the behavior clearly separate from the content and presentation.
The ASP.NET MVC Framework allows for very lightweight markup. Any state maintained by applications is targeted, and usually a small fraction of ViewState on similar Web Forms pages.
Consider the following traffic reports from an HTTP traffic diagnostics utility – Fiddler tracking two similar applications.
Internet Explorer no longer commands the 90+% market share that it used to, making it very important to ensure that Web applications are browser agnostic.
ASP.NET MVC applications and controls typically implement their client-side functionality using jQuery. This leads to solid browser compatibility.
Solid and easy testing of business logic and data access is considered to be critical to the development of maintainable Web applications.
Web Forms applications are very hard to test. The view often contains business logic and presentation, making it very hard to test.
ASP.NET MVC makes testing easy, even fun. All of the core components of ASP.NET MVC are designed to easily run from any unit testing container.
Friendly URLs fare well with search engines since these URLs allow the search engine to correlate terms that appear in the URL with other aspects being considered to determine ranking.
It is possible to formulate friendly URLs with Web Forms. This is not, however, the norm.
ASP.NET MVC treats action methods as page content and completely hides physical page details. The routing system is very elegant and tightly woven into the framework, allowing for the crafting of friendly URLs.
Web Forms has a wide variety of controls available from Microsoft and numerous third-party vendors. They make it easy to add a rich and polished user interface to your applications.
It is a common misconception that ASP.NET MVC does not offer a rich set of user-interface elements. Microsoft provides a limited set of helpers out of the box, but a solid third-party control market is taking root. Every major component vendor has a currently shipping suite of controls or has one in the works.
For example, Syncfusion offers rich menus, editors, grids, charts, an Outlook-like scheduler, gauges and much more.
With Microsoft Visual Studio 2010, ASP.NET MVC is tightly integrated into the IDE. Visual Studio’s excellent scaffolding support for ASP.NET MVC allows for a very productive experience. It takes only a few clicks to create a fully functional, strongly typed view for an action method. ASP.NET MVC’s convention-over-configuration approach makes it very easy to get started. You can certainly build a great looking UI with minimal effort when working with ASP.NET MVC.
With ASP.NET MVC you can truly venture to build websites that offer extremely compelling experiences.
- Consider the ASP.NET MVC 2 platform for your Web development needs
- Download a suite of ASP.NET MVC controls from your favorite vendor and put them to the test
- Beat your competition to the punch and be the first in your industry to switch to ASP.NET MVC!
There is simply no excuse to be toying with ViewState anymore!
 Note: This article is excerpted from the full white paper, which can be downloaded here.