Increasingly, companies are choosing ASP.NET MVC for green field development and for significant revisions of existing sites. But does ASP.NET MVC really bring concrete benefits that can be justified to upper management?
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you full control over markup for enjoyable, agile development. ASP.NET MVC includes many features that enable fast, TDD-friendly development for creating sophisticated applications that use the latest web standards. [Reference]
ASP.NET MVC has a lot of technical goodies that developers have fallen in love with.
The main advantages of ASP.NET MVC are:
- Separation of concerns (SoC): From a technical standpoint, the organization of code within MVC is very clean, organized and granular, making it easier (hopefully) for a web application to scale in terms of functionality. Promotes great design from a development standpoint.
- Easier integration with client side tools (rich user interface tools): More than ever, web applications are increasingly becoming as rich as the applications you see on your desktops. With MVC, it gives you the ability to integrate with such toolkits (such as jQuery) with greater ease and more seamless than in Web Forms.
- Search Engine Optimization (SEO) Friendly / Stateless: URL’s are more friendly to search engines (i.e. aryalnishan.com/blogs/ 1 – retrieve user with an ID of 1 vs aryalnishan.com/blogs/details (id)). Similarly, since MVC is stateless, this removes the headache of users who spawn multiple web browsers from the same window (session collisions). Along those same lines, MVC adheres to the stateless web protocol rather than ‘battling’ against it.
- Works well with developers who need high degree of control; Many controls in ASP.NET web forms automatically generate much of the raw HTML you see when an page is rendered. This can cause headaches for developers. With MVC, it lends itself better towards having complete control with what is rendered and there are no surprises. Even more important, is that the HTML forms typically are much smaller than the Web forms which can equate to a performance boost – something to seriously consider.
- Test Driven Development (TDD): With MVC, you can more easily create tests for the web side of things. An additional layer of testing will provide yet another layer of defense against unexpected behavior.
ASP.NET MVC uses interface-based contracts, which allow components to be more easily tested in isolation. As a result, cleaner and more testable code is often promoted as a good reason to embrace ASP.NET MVC.
ASP.NET Web Form
ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access. [Reference]
The main advantage of ASP.NET Web Form are:
- Development supports state: Gives the illusion that a web application is aware of what the user has been doing, similar to Windows applications. I.e. Makes ‘wizard’ functionality a little bit easier to implement. Web forms does a great job at hiding a lot of that complexity from the developer.
- Rapid Application Development (RAD): The ability to just ‘jump in’ and start delivering web forms. This is disputed by some of the MVC community, but pushed by Microsoft. In the end, it comes down to the level of expertise of the developer and what they are comfortable with. The web forms model probably has less of a learning curve to less experienced developers.
- Mature; It’s been around since 2002 and there is an abundance of information with regards to questions, problems, etc. Offers more third-party control – need to consider your existing toolkit.
ASP.NET Web Forms and MVC are two web frameworks developed by Microsoft – they are both good choices. Neither of the web frameworks are to be replaced by the other nor are there plans to have them ‘merged’ into a single framework.[Reference]