9 Apr

Book Review: ASP.NET MVC in Action

Category:UncategorizedTag: :

ASP.NET MVC in Action

Earlier this week I finished reading ASP.NET MVC in Action written by Jeffrey Palermo, Ben Scheirman and Jimmy Bogard.  I came across several good reviews about this book so I finally decided to give a read. 

This book is not just about the API?s of the ASP.NET MVC framework but also about good design principles for creating long-lived web applications. When you?re not familiar with the S.O.L.I.D. principles and also want to learn about the very basics of Domain-Driven Design in the context of web applications, then this book is definitely for you. For me personally, being indoctrinated with this stuff for quite some time now, I didn?t pick up that many new things except for some of the ins and outs of the  ASP.NET MVC framework. 

Nonetheless, I strongly believe that this kind of books are still highly needed to raise the bar of quality in the .NET community. Practices like unit testing, continuous integration, DRY, etc. are sadly enough not part of the mainstream yet. The authors also had the courage to provide an entire chapter where they explore other MVC frameworks like MonoRail and Ruby on Rails which, from my point of view, adds tremendous value to the awareness of the unsuspecting .NET developer.

The first three chapters provide an in dept overview of the parts that constitute the MVC pattern, namely the Model, the View and the Controller. I must say that I?m still not a big fan of the way ASP.NET MVC passes a dictionary of data to its views. I know that you don?t have to use it this way and that a single strongly typed model can be passed to the view. But the presence of a dictionary for me is just a too big a risk that can easily result in creating a mess.

Chapter 5 provides a solid overview of the routing capabilities of the .NET framework including some nice examples. Chapter 6 contains information on how to extend ASP.NET MVC using controller factories, action filters, custom view engines, etc. ? . Chapter 7 discusses how to leverage view helpers and creating partial views which I find are quite important features for composing scalable web applications.

Chapter 8 is the one I skimmed through very quickly as it shows how to use existing ASP.NET features with ASP.NET MVC. The part on using existing ASP.NET server controls is totally unnecessary and although you can pull it off in a couple of cases, I advise you to not apply these techniques in a production application.

Chapter 9 shows how to use AJAX in ASP.NET MVC. Pretty basic examples there.

Chapter 10 talks about deployed and contains some interesting ideas on how to use MsBuild, NAnt, Rake, ? for automatically deploying a web application into a testing and/or production environment including configuration and environmental setup. 

As already mentioned, chapter 11 shows some basic features of other MVC frameworks. In the last two chapters, the authors provide some best practices and recipes for ASP.NET MVC.

As I already mentioned, if you?re only goal is to get up to speed with the API of ASP.NET MVC then I guess there are better resources out there. For that reason I also bought the Mastering ASP.NET MVC 2.0 series on TekPub to fill in the potential gaps and also to learn more about the new stuff in ASP.NET MVC 2.0.

All in all, I enjoyed reading this book. If I have to give one suggestion for improvement, then I would advocate to add more cohesion to the book. I feel that some topics are scattered all over the place. For example, the use of Castle validators is discussed in two different chapters in the book with some degree of overlap. If only one part of the book was devoted to validation, then its far more easier to go back there for future reference.

I noticed that a second edition of ASP.NET MVC in Action is already available as an early access edition. While looking at the table of contents, some of the content from the first edition has certainly been moved around which I consider to be a good thing. I also hope that the second edition will also include some comparisons with features from Fubu MVC and OpenRasta.

Until next time