ASP.NET MVC - Battle of the Books

There's always a splurge of new books that come out around the RTM of any new ASP.NET related technology. Authors all over the place are burning the midnight oil, cursing the changes from one CTP to the next, through to Betas and hoping against hope that the Release Candidates and final RTMs aren't stuffed with "breaking changes" which inevitably mean total rewrites of whole sections or chapters in their draft. And then the race between the publishers is on, as each tries to get their offer to market before the others. Here, I look at three of the titles that were published around the time that ASP.NET MVC was launched, and give my judgement on how they fare in covering not only the core Framework but the key features that ASP.NET MVC is designed to offer:
  • Clean separation of concerns
  • Extensibility
  • Testability
  • Control over HTML

Professional ASP.NET MVC 1.0

Professional ASP.NET MVC 1.0

Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
WROX, ISBN 978-0-470-38461-9
434pp
Code Samples in C#

Hmmm. The Four Foreheads.

Conery, Hanselman and Haack are all senior figures within the ASP.NET team at Microsoft. Scott ("The Gu") Guthrie is the second most influential person in popular 21st century culture (after Simon Cowell), judging by the number of "Awesome!! You rock, Scott!!!" comments his every blog utterance attracts. He also "builds a few products for Microsoft". It says something about the perceived importance of the MVC Framework within Microsoft's Developer Division (which Scott Guthrie actually runs), that these four people should author a book, and then not publish it through Microsoft Press.

The book is split across two sections. The first section (Chapter 1), runs for 164 pages, and consists of an end-to-end walkthrough showing how to use the new Framework to build an application - NerdDinner. It's a relatively simple application but it features the kinds of CRUD scenarios that are most commonly found in web applications, and other features such as AJAX with ASP.NET MVC and Authentication/Authorisation. It serves its primary purpose of introducing the MVC Framework, and provides a good all round insight into this style of web development. The second section of the book comprises a further 11 chapters - each of which examines aspects of the ASP.NET MVC Framework in more detail.

I cheated a little bit with this book. I had already taken advantage of the PDF version of the first chapter that was made freely available a while before the book was finally published, so when I received the book itself, I turned straight to Chapter 2, which is about half way through the book. It contains a very interesting overview of MVC as an architectural pattern, and looks at its evolution within web development. Chapter 3 appraises ASP.NET Web Forms (candidly) and establishes the reason for introducing an MVC Framework under the ASP.NET banner. These two chapters had me completely hooked. Immensely readable and informative, the third (and subsequent) chapters feature a number of insets: Product Team Asides. In these, the thinking behind the design of the ASP.NET MVC Framework is divulged, including explanations of decisions that were made during development. Subsequent chapters give good coverage to Routing, Controllers, Views, AJAX, Filters and Security. A briefish look at Test Driven Development and Testable Design Patterns is provided and the book is wound up by a chapter on mingling Web Forms and MVC.

The practical introduction to ASP.NET MVC in the form of the NerdDinner chapter is extensive and informative. On its own, it covers a lot of the information you would expect to find in a "Beginning ASP.NET MVC" type of book. Despite that, this book is not intended to serve the purposes of those completely new to ASP.NET or web development. You will need to be familiar with web development of some kind, and practiced at C# - or willing to do a lot of reference look-ups while going through this book. The second half of the book provides a very useful reference, as well as guidance on more advanced topics.

All in all, this book is worth getting. It's clearly structured, well written and does the job it intends to. It covers the core framework well and also clean separation of concerns. While extensibility and testability were covered, ideally I felt that more could have been done in these areas.

ASP.NET MVC 1.0 Website Programming Problem - Design - Solution

ASP.NET MVC 1.0 Website Programming Problem - Design - Solution

Nick Beradi, Al Katawazi, Marco Bellinaso
WROX, ISBN 978-0-470-4105-0
524pp
Code Samples in C#

The original idea behind the "Problem - Design - Solution" series, which first appeared in 2002, was to move away from the typical reference-style of programming book, and to show developers with some experience of the ASP.NET Framework how to structure and implement an application using a Best Practices approach to ensure separation of concerns. It was updated in 2006 following the launch of Version 2.0 of the Framework, and introduced a large number of the new features that version brought to the party. It has been updated again since then to take in version 3.5.

The series centres around developing the BeerHouse application, which is available from CodePlex. The application contains a range of features that could appear in any "real-world" site, including user membership, content management, polls, comments, newsletter management and generation, localisation and e-commerce. For web forms developers looking to improve their development skills beyond a two-layer approach that involves much use of Code-Behind, this series has established itself as invaluable. The second book in the series is one of the more thoroughly thumbed tomes in my personal collection, and I would say that this book did more for me in terms of understanding how to separate the various layers in my applications than any other resource.

The MVC version follows the same pattern as its predecessors, and demonstrates a rewrite of the BeerHouse application using the MVC Framework. As with previous versions in the series, each element of the application is broken down into a Problem Statement, followed by an examination of the application Design considerations that the Problem introduces, and finally the code, or Solution that was implemented. That, unfortunately, is as far as any similarity with the previous books go.

Coverage of the MVC Framework as a development technology is pretty superficial, in my opinion, and indeed the authors refer readers to MSDN or a reference type book for more detail too often. So, the book is not intended to teach you the MVC Framework. Ok - maybe the book is intended to be a guide to Best Practice when using ASP.NET MVC in real world applications? Indeed, as part of the introduction, the authors claim that "you will have learned many of the best practices for web development, based on a solid, scalable, and extensible architecture" by the time you have reached the end of the book. Most commentators on Best Practice for ASP.NET MVC strongly advocate a TDD approach to development, or Unit Testing at the very least. This book ignores both. You will not learn how to implement any kind of testing framework at all. How about a true separation of concerns? Unfortunately, any hope I had that the book might help in this direction was blown out of the water when I downloaded the sample application. One of the Views (Article/Index) contains a call to the DataContext, and one of the PartialViews includes Code-Behind. Beyond that, the Model is exposed directly to the Controllers, with calls to the DataContext inside the Actions. this hardly fits in with the notion of a "clean" separation of concerns.

There are a number of technical and factual inaccuracies throughout the book. The authors refer to the Html and Url extension classes. They are in fact extension methods. According to the authors, the ASP.NET 3.5 team introduced the Provider model, and Profiles. They were actually introduced in version 2.0. ALT.NET is offered as a process by which you can develop your Model. It's actually not a process at all. It's a movement, if anything, that shares a set of beliefs. While most of us know that interfaces are implemented by a class, the authors will have you believe that classes inherit from interfaces. Oh - and did you know the GridView is obselete? No? Nor did I. But on page 143, I find the following:

"You may notice in this code that we are using plain old tables to show our data, This is because the GridView control that we have used so frequently in ASP.NET 2.0 is now obselete."

Individually, these errors would probably not merit a mention. However the sheer number of them (and there are more than the ones I highlighted) shakes my confidence in the technical accuaracy of the book as a whole. Another aspect of the book that left me feeling underwhelmed is the fact that large chunks of the 2.0 version of the book have been copied and pasted directly into the MVC version. However, not enough care was given to reviewing and amending the copied parts. For example, in both the Opinion Polls section and the Forums section, the LINQ queries that are used to access the database are introduced as "Stored Procedures". The text introducing them is identical to the 2.0 version of the book, but there are no stored procedures in the MVC application. I cannot understand why, in the Chapter on Localisation, the Recap of Localization in ASP.NET 1.x was retained from the 2.0 version of the book. Given that 2.0 has been with us since 2005, it seems utterly irrelevant.

Given the heritage of the Problem - Design - Solution series of books, I was keen to find something positive to say about this title. But the more I looked, the more I got irritated by it (especially with the continual reference to Partial Views as "User Controls"), and even started to feel a little cheated. I could be forgiven for thinking that the new authors wanted to do as little as possible in terms of having to re-write Marco Bellinaso's original passages. I also suspect that Bellinaso's only contribution to the book, despite appearing on the cover as one of the authors, was to allow so much of his earlier work to be re-used. This may be why he is alone in not producing anything in the Acknowledgements section at the beginning of the book. If you are looking for a book to get you started with ASP.NET MVC, this one is too shallow on the technology to merit consideration. If you are looking for something to guide you towards Best Practice, this book doesn't offer anything in that direction either.

In summary, coverage of the core elements of the Framework is thin, and extensibility, testability and clean separation of concerns are ignored.

Pro ASP.NET MVC Framework

Pro ASP.NET MVC Framework

Steven Sanderson
Apress, ISBN 978-1-4302-1007-8
590pp
Code Samples in C#

This book follows a similar format to the Four Foreheads' offering, in that it begins with a number of chapters (spreading over 120 pages) that walk through building a real-world application using MVC, to introduce many of the features that come with the new Framework, and then follows this up with indepth coverage of specific areas - Routing, Views, Controllers, Ajax, Security, Deployment and the crossover between Web Forms and MVC. Where it differs significantly from the Four Foreheads is that Test Driven Development and design patterns are covered in significant detail from the off.

ASP.NET MVC is likely to introduce Test Driven Development, Inversion of Control and other design patterns to a new audience who up till now have not appreciated what they are all about. Sanderson makes these topics extraordinarily accessible through the clear way in which he explains them, and the way he integrates them into the sample application. The application (SportsStore in this case) makes use of NUnit and Moq for test, and Castle Windsor as an Inversion of Control container. Sanderson is also aware that TDD is not going to be right for everyone, and took the trouble to separate the commentary on testing from the actual development side of SportsStore by placing it in separate panels. The sample application is not intended to be "demo-ware", according to Sanderson. He deliberately sets out to establish through the application, a sound architecture and many modern best practices. The result is not as fully-featured as the BeerHouse, but this is the approach that I kind of expected Beradi and Katawazi to have taken.

Sanderson prefaces the walk through with a chapter called "Prerequisites". In this, he does an excellent job of introducing the C# 3.0 language features that are important to ASP.NET MVC, and also does another outstanding job of simplifying LINQ to SQL, which he then uses as his Data Access technology. During the subsequent chapters that examine core aspects of the Framework, Sanderson provides a lot more information than the Foreheads. What he does is focus on the first of the tenets listed above, and show how the Framework can be extended. For instance, in his coverage of Controllers, he shows how to extend the ActionResult type to produce a custom WaterMarkedImageResult, as well as how to create your own ControllerFactory. Within the chapter on Views, he discusses and illustrates implementing your own View Engine, and he looks at some features outside of the core Framework, such as the MVC Futures and MvcContrib. The chapter on Deployment was particularly useful to me in helping towards a smooth transition from my old Web Forms-based site to this version, hosted on IIS 6.

Steven Sanderson has a a very comfortable writing style. His tone is quite conversational, and his sense of humour is apparent throughout the book. And it's a genuinely warm, understated sense of humour - he avoids that kind of "Geek Humor" that besets programming books these days. His obvious depth of knowledge on his subject matter and passion for it come across fluidly, and I always had the feeling that he was acting as my personal mentor, as opposed to lecturing me.

Sanserson's book is head and shoulders above the others in many ways, especially the most important one - the coverage he gives to the elements I am measuring each book by. His coverage of the core elements of the framework is outstanding. His frequent examples on extending the framework and his inclusion of testing as part of the sample application along with use of an Inversion of Control container means that this book wins hands down.

This is apparently Steven's first programming book. I'm certain it won't be his last.

Summary

I really enjoyed reading the book by Conery, Hanselman, Haack and Guthrie. I found the insights they gave into the product team's thinking very interesting. On its own this book would get me started with ASP.NET MVC quite nicely. I will certainly be picking it up again from time to time to review their take on certain aspects of the framework. Unfortunately, I cannot think of one good reason to take the "Problem - Design - Solution" book off my shelf again. I find it hard to describe just how disappointed I was in this book. Finally, I will have difficulty in retrieving Steven Sanderson's volume from my shelf. That's because it is unlikely to be there. I will have to hunt the desks of the other developers late at night to get it back off them. Or buy them each a copy. But this book is so good, it will be worth it.

Date Posted: Monday, July 27, 2009 1:25 PM
Last Updated: Friday, October 10, 2014 9:19 PM
Posted by: Mikesdotnetting
Total Views to date: 41238

10 Comments

Tuesday, July 28, 2009 9:05 PM - Aldi

I wish you had written this review before I bought the ASP.NET MVC 1.0 Website Programming Problem - Design - Solution book. Your comments are spot on.

Tuesday, July 28, 2009 11:11 PM - Sammy

I think you are being rather harsh on the "Problem - Design - Solution" book.

Personally I found it very helpful, but I am not up to your caliber yet. I just started developing ASP.NET 1 year ago, so all of this is very new to me. I found the content very engaging and they showed a lot of glue on how to get jQuery and MVC to play nicely. I really enjoyed the read, because it spoke to me as somebody new to the ASP.NET MVC framework, and it got me started pretty quickly.

Either way nice reviews, although I disagree with one of them.

Wednesday, July 29, 2009 7:50 AM - Mike

@Sammy

Thanks for your views.

I can only review the books based on what I already know, and what I hoped they would teach me. I've only recently started with MVC, so I kind of knew what I wanted to learn about. I also had an expectation of the BeerHouse book based on its predecessors.

I did wonder if the BeerHouse book would be useful to someone with limited ASP.NET experience who wanted to get the basics of MVC under their belt quickly, and suspected that it might - in much the same way as the NerdDinner PDF might. It is definitely more of a beginner's book than a Best Practice book.

I found the content a little awkward in places because I didn't think the merge between the old text and the new was done very well. It's interesting to hear that you found the book useful, though.

Thursday, July 30, 2009 1:57 PM - Anise

I have recently started using MVC Framework but am very experience with ASP.NET. I kind of also disagree with the review, I read both the Professional book and the Problem - Design - Solution book and i preferred the problem design solution book. Nerd dinner was just so cursory and the whole book just barely scratched the surface in my opinion. As for problem - desing - solution I agree with sammy that the jquery integration was awsome. I'm so glad someone talked about its use rather than the crappy MS Ajax solution which is always breaking. The other thing I liked about the book is I had a project whereby I had to create a mvc e-commerce based solution and their open source project offered a great example to design my own system. I think its the most feature complete MVC demo presently on the internet. As for sandersons book I have not read it so I can not give any opinion.

Thursday, July 30, 2009 4:10 PM - Mike

@Anise,

People's views and opinions are always going to be shaped by their expectations, experience and existing knowledge. I'm pleased that both you and Sammy have taken the trouble to share your views here.

I do agree with both of you about jQuery being a lot nicer to work with than ASP.NET AJAX. It seems our experience, expectations etc are pretty much the same in that regard ;o)

Sunday, August 9, 2009 7:07 AM - jm

Thanks for the reviews. I follow the blogs/articles of Rob, Phil, Scott, and the Scott Gu. I also downloaded the pdf chapter of nerd dinner and found it very very useful in understanding MVC. I have also been reading the manning book ASP.NET MVC in Action. I have read 4-5 chapters and I have to say that it is a pretty well written book. They emphasize on separation of concerns, TDD and other best practices. Aslo the writing style is very enjoyable to read. I would like to know your thoughts about this book if you get a chance to read it. I will consider buying Steve Sanderson's book. I remember Scott Gu also praised it once in one of his blogposts.

Sunday, August 9, 2009 8:44 PM - Mike

@jm

At the moment, that title is only available as a preview copy electronically. I will certainly consider reviewing it when it is published next month.

Friday, September 4, 2009 3:07 AM - terpdev

If you haven't done it already, check out Stephen Walther's new book ASP.NET MVC Framework Unleashed. Great book. Includes Entity Framework.

Friday, September 4, 2009 6:36 AM - Mike

@terpdev

If the pubishers want to send me a review copy, I'll certainly review it. But I sent them an email over a month ago, and they have never responded. Same thing with Manning and their ASP.NET MVC In Action book.

Thursday, November 26, 2009 2:00 AM - Randy

To begin with, I would like to thank you for your review of these books. I have read them all and I agree with you 100%.

I had extensive experience with ASP.NET 2.0 Website Programming Problem - Design - Solution. Excellent book! I think Scott Guthrie's endorsement on the front cover is accurate!

Unfortunately, I also have read ASP.NET MVC 1.0 Website Programming Problem - Design - Solution. In my opinion, this book was a big disappointment in so many ways :-(

The latest version of this book is ASP.NET 3.5 Website Programming Problem - Design - Solution. I have not read this latest book. However, I would like to suggest that anyone considering purchasing this book to first take a good look at http://thebeerhouse.codeplex.com. TheBeerHouse is now in it's 4th version and they are all hosted in the same CodePlex project. The discussions and issue tracker items for all 4 versions are co-mingled.
Add your comment

If you have any comments to make about this article, please use this form to do so. Make sure that your comment relates specifically to the article above. More general comments can be posted through the form on the Contact page.

Please note, all comments are moderated, and some may not be published. The kind of things that will ensure your comment is deleted without ever seeing the light of day are as follows:

  • Not relevant to the article
  • Gratuitous links to your own site or product
  • Anything abusive or libellous
  • Spam
  • Anything in a language I don't understand including gibberish.

I do not pass email addresses on to spammers, so a valid one will assist me in responding to you personally if required.