Monday, March 1, 2010

Book Review: ASP.NET MVC Framework Unleashed

I just finished reading ASP.NET MVC Framework Unleased by Stephen Walther.  It was an extremely fast read: I finished it in a little under two weeks.  Unfortunately, I was able to finish it so quickly because it contained very little information.  I was rather disappointed by the content.  I really don't like giving bad reviews, but I feel like I should get my thoughts down for other folks who may be interested in this topic.  Please note, this is a review of the book itself, not the underlying ASP.NET MVC technology.

Beginner, Intermediate, or Advanced?
My biggest problem with Unleashed is that it cannot decide what level it is targeted at.  The cover lists it as "User Level: Intermediate-Advanced," but the actual content seems to jump from one level to another.  For example, there are step-by-step instructions on configuring and using the ASP.NET Membership Database (ASPNETDB.mdf).  I would consider this to be "beginner" level content.  For the majority of real-world applications, you will not use the ASPNETDB.mdf database for your user authentication / authorization, instead going for a more robust security model such as implementing a custom MembershipProvider.  This is not covered, however.

But the text does not qualify as Intermediate or Advanced as there is very little actual content.  The majority of the book is code samples.  Code samples are generally a good thing, but the code samples here are full-files.  This means that when looking at the various elements (such as Views and Controllers), you end up seeing the same "boiler-plate" code over and over again.  Many times there are only a few unique lines of code in a 30 line listing.  In addition, descriptions of the code samples are limited to a paragraph or two with no in-depth description of the concepts at hand.  This is combined with listings in both C# and VB (again, not necessarily a bad thing).  I often felt like I was "skimming" a 30 page chapter in just 10 minutes or so due to the use of code samples and lack of description.

As a final example, there are 2 chapters devoted to AJAX and jQuery.  In the introduction to the book, the author assumes that the reader is familiar with HTML and .NET (either C# or VB).  However, it does not mention AJAX or jQuery as pre-requisites.  AJAX is used much differently in ASP.NET MVC than it is in Web Forms, yet there is no discussion of those differences.  There is just a handful of samples with little explanation.

Lack of Focus
Another problem is the lack of focus.  ASP.NET MVC has many unique features, but many of the concepts are shared with ASP.NET Web Forms and the .NET framework at large.  I wanted the book to focus on the concepts that differ from non-ASP.NET MVC applications, but there was a lot of overlap.

To expand on the example above (the Membership database), the security concepts (users, roles, principles, etc.) are the same as ASP.NET Web Forms applications, but there were several large sections dedicated to authentication.  And as noted above, this was only at the "beginner" level and did not touch on intermediate or advanced topics.

As another example, Unleashed spends a lot of time with the Entity Framework.  There are step-by-step instructions on creating a SQL Express database and setting up Entity Framework entities.  In addition, it also spends a bit of time talking about the Repository pattern and Service layers of the application.  These all related to the "M" (Model) of MVC.  But the point of the "M" is that you can implement your model in an infinite number of ways.  Again, this may be appropriate for a "beginner" level book, but it should go beyond merely mentioning other options if it is trying to be something more.

Ironically, I think that the topic covered best by this book is Test Driven Development (TDD).  Throughout the text, there is a focus on the "Red / Green / Refactor" methodology of TDD.  And the final part of the book (6 chapters on building a sample application) is a very good walkthrough of using the test-first method to fulfill the use cases.  Had this book been called Test Driven Development with ASP.NET MVC, I would probably give this book a much better review.

Summary
Ultimately, the only reason that I was able to follow this book is because I went through ASP.NET MVC training.  But the reason that I purchased the book was so that I could have a reference with more detail.  As an example, I was looking for details on HTML Helpers, both the helpers "in the box" and custom helpers.  The book has a few mentions of the existing helpers, but does not go into any detail on the options and parameters available.  As for creating custom helpers, there is an example of it, but nothing much beyond the sample code.

I really don't like giving bad reviews.  I realize that putting any technical book together is a lot of work.  However, technical books are also my life-blood.  They are my primary source of in-depth learning.  In addition, they are quite expensive.  I do have enough information to complete my project (which was the primary goal of training + book), but I'm still looking for a good reference book.  Since ASP.NET MVC version 2 is just around the corner (releasing with .NET 4.0 in April), I'll probably hold out before purchasing another.

In working with ASP.NET MVC, I'm becoming a fan of it.  So, I'll be posting more about the technology topic in the future.  I'll also keep you informed of other useful resources that I run across.

Happy Coding!

No comments:

Post a Comment