ASP.NET MVC 2.0 in Action: A Review

Disclaimer: I am already familiar with ASP.NET MVC and have worked through some projects in 1.0 and played with the 2.0 bits. The reason I have this disclaimer is this is not a review from a newbie standpoint. I make no warranty that a newbie will have the same feelings I have about the book, although I will address my feelings on this as we go along.

I picked up the book ASP.NET MVC 2.0 last week and started ripping through it. In this review, I want to lead through the pluses and minuses of the book. Before doing that, I want to go into why I chose this book as a starting point into MVC 2.0.

My journey started last week in Barnes and Nobel in Round Rock, Texas (La Frontera). I got copies of all three of the currently released MVC 2.0 books and looked through them. I was looking for quite a few different things in the books, including the following:

  • Wide variety of depth from the basics of MVC to more advanced topics
  • Use of best practices (testing)
  • Use of common third party libraries. As an example, the book had to have decent coverage of JQuery.

The three books I looked at:

My feelings about the Wrox book was it felt like a MVC 1 book with a chapter on 2 added. This does not mean it is not a good book to learn from, only that I was looking for something that felt 2.0 all the way through. I dumped Programming ASP.NET MVC due to the lack of JQuery, which is probably a bit petty of me, but you have to draw the line somewhere. I am happy with the Esposito books I have purchased in the past, so it was a bit arbitrary.

Let’s get the negative feedback out of the way first.

Negative Points

I have these in order of importance or how I rank these in importance.

Disconnects in Multiple Author Books

One issue with multiple authors is a disconnect. There are two forms of disconnect common to this form of authoring:

  1. Repeat of information in 2 or more chapters
  2. Different toolsets used to solve the same, or similar, problems

In most instances, repeat of information (issue #1`) is the more annoying of the two, so . While seeing different viewpoints on a topic is valuable in some contexts, it is more often more time consuming without much benefit in the context of a technical book.  Repeat of content is not a big issue in ASP.NET MVC 2.0 in Action. I have seen the #1 issue in numerous books in the past, but the lead author seems to have taken control so each chapter is very specific in content. This does not mean there is no overlap and repeat, but that there is no overt duplication of content.

Different toolset to solve the same problem (Issue #2) is more prevalent in the book, as each author has chosen his own toolset. It is not a huge problem, as many of the authors either work, or have worked for, the same company. But there is some disconnect. In particular is the choice of JQuery for UI and ASP.NET AJAX for validation, as JQuery is a good solution for validation and Microsoft includes JQuery in all ASP.NET MVC projects, as a standard component.

This issue would not be as glaring if both JQuery and ASP.NET AJAX were highlighted as a validation solution. Throughout the book, there are many cases where multiple options are shown. For example, chapter 13 includes StructureMap, Ninject and Castle Windsor for Dependency Injection. We also see the Spark view engine as an alternative to the standard ASPX view engine. This makes the exclusion of JQuery for validation all the more glaring.

Please note, I am not against ASP.NET AJAX for validation. It is more about a disjoint in presentation of the material. That, and a reliance on two different libraries to accomplish what a single library can accomplish. If the chapter either a) showed both or b) made a case for using ASP.NET AJAX over JQuery validation, I would be completely on board.

This pretty much covers the “major” negative feedback point I have for the book. I had a brief talk with Eric Hexter today and understand how schedule and MVC changes drove this negative.

Disjointed Sections

I can’t put my finger on any one item at this point in time, but there are a few areas where the book feels like items have been shoved into the chapters. It is minor overall, as evidenced by my lack of a concrete example at this point in time, but they are evident by a break in flow. Overall, as you read the book, you feel like you are moving with the current. But occasionally, there is a dam in the river that forces you to stop and get your bearings.


Now that we have that out of the negatives out of the way, here are my feelings on the positive side.

Adherence to proper coding standards

It has often been a pet peeve of mine when I pick up a book and all of the samples are simple concept/theory only samples. While I understand the need to get concepts down with very simple examples, an entire book devoted to these types of samples is a waste of time, in my opinion. In addition, samples like the following tend to teach people bad habits:


public class HomeController : Controller
public ActionResult Index()
var dataContext = new MovieDataContext();
var movies = from m in dataContext.Movies
select m;

    return View(movies);

NOTE: The bad habit here is muddying the controller with data access code.

Fortunately, this book is one of the exceptions of the bad coding rules. When there are simple samples, the authors take time to show you how to improve on the code and make it more applicable to real world applications. In addition, there is an entire chapter devoted to avoiding some of the more common site hacks. This, in and of itself, is worth the price of admission.

Domain Driven Design

While the authors are quick to disclaim the chapter on Domain Driven Design as overly simplistic, it is a very good intro for people who have never coded using a DDD style. The idea of separating the data access “models” and presentation models from domain models is foreign to many developers, making this a very valuable chapter. I would still recommend books like Domain-Driven Design: Tackling Complexity in the Heart of Software (or Applying Domain-Driven Design and Patterns: With Examples in C# and .NET, if you want something .NET focused) to fill in the knowledge gaps, but Chapter 8 is still a very useful intro to the concept and well done.

Nice Sample Project

Talking to Eric, the authors spent time developing the project prior to writing the book, and it shows. The majority of the samples, especially as you move farther into the book, focus on the sample project. And while the chapters do not always build in a solid flow, the project is something you can use to get a grasp. It would be nicer to see some of the methods and mechanics surrounding the development of a project, since they took the time to build one, but I realize this is a book on ASP.NET MVC and not developing a project, per se.

Good use of alternatives

The book contains a chapter that shows the Spark view engine, so you can get a taste of what it means to move away from the standard ASPX view engine. It would be nice if it also contained a bit more info on why you would use Spark (pros and cons), but there is enough to get a taste of how Spark works. It could well whet your appetite to play around a bit more.

Then there is an entire chapter on IoC containers featuring StructureMap, NInject and Castle Windsor. It would have been nice to see a bit of Unity in the mix, as Unity is the new IoC container Microsoft is pushing, but the chapter gives a nice feel for using IoC containers for dependency injection in your ASP.NET MVC application, which is something you should explore if you want to take testing seriously.

Excellent Use of TDD

While it is not always at the forefront of every chapter, it is obvious the authors took testing seriously and devoted a lot of effort to testability in their sample application. Perhaps it is not strong enough, and some readers could walk away unconvinced, but I am firm believer that tests put the science in computer science and readily advocate test early at minimum, preferably TDD, in all of the projects I spearhead. I find it pays off on all levels once the learning curve is overcome. And it pays huge dividends with change orders and bug fixes.


If I had to choose a five star rating, ASP.NET MVC 2.0 in Action earns a solid 3.5, with some chapters rated higher. Other than the few flaws I have pointed out, and perhaps a few more I cannot think of at the moment, there is very little content that would earn less than 3 (average).


One Response to ASP.NET MVC 2.0 in Action: A Review

  1. Jason says:

    Good review, thanks for the info! It is tough to keep up with this and my college work, not to mention my day to day job!! 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: