# Wednesday, 28 October 2009

Microsoft ASP.Net MVC (aka "MVC") is a new framework from Microsoft designed to encourage loose coupling between the user interface and the data layer of a web application. With MVC, an application is logically divided into the Model (the data), the View (the user interface) and the Controller (code to retrieve and manipulate data before passing it to the View). This framework makes it nearly impossible to add business logic (or any code for that matter) to the UI layer; Business logic in an MVC application belongs in either the Model or the Controller. MVC allows for greater separation of concerns, more control over the HTML output and easier unit testing of a greater percentage of your code.

Professional ASP.NET MVC 1.0 by Rob Conery, Scott Hanselman, Phil Haack and Scott Guthrie describes the framework, how to use it, and how to exploit these advantages.

A significant part (about 40% of the text) of this book can be downloaded free. Chapter 1 - the free download written by Microsoft VP and cyber-celebrity Scott Guthrie - describes an ASP.NET MVC application called 'Nerd Dinner'.  This is the chapter I spent the most time on. I used Nerd Dinner as a model to build my own MVC application, striving to understand why the code was written as it was and how the framework was used. For me, this was the most useful part of the book.

This is not to say that the rest of the book is useless - It was very informative. I especially liked the chapters that dove deeper into explaining the Routing Engine, the Controllers and the Views. These chapters weren't comprehensive enough to be a definitive reference, but they were clear and concisse and I learned the flexibility of this framework and alternative ways to use it.

Other chapters describe how to use JQuery and Ajax to make MVC applications more dynamic and visually appealing. The authors devoted two chapters to testing because this is one of the major benefits of MVC.

The final chapter describes how to integrate MVC and the traditional web forms framework into a single application. I appreciated this because so much of my work is modifying existing systems.

My recommendation is to download and read the free chapter of this book before deciding whether to invest the 50 bucks on the larger dead tree version. This will give you a better perspective on the framework and you will make the rest of the book more relevant. If your goal is simply to evaluate this framework or get exposure to it, this chapter may be sufficient.

But if your interest is piqued by Nerd Dinner, the remainder of this book is a good start in learning MVC.

books | MVC