I was looking for a good book to get started with the ASP.NET MVC framework now that I've found the time to actually sit down and play with it. I'd used Castle MonoRail pretty extensively in the past on a few client projects and I've played with Ruby On Rails quite a bit too, so the idea of MVC wasn't new to me. I was really looking for a book that talked about using Microsoft's MVC framework and one that explained some of the best practices, rather than just a primer or reference since I already had the MVC idea down pat. In that regard, I think ASP.NET MVC 2 In Acton really shined.
ASP.NET MVC 2 In Action is laid out into four sections. The first section is called High Speed Fundamentals and it focuses on a quick overview of what the Model-View-Controller paradigm is all about and then a chapter delves into each of the layers individually as a primer. There's also a chapter which explains what things from the WebForms world are still usable in the MVC world. There's a good amount of valuable info in this section, but it is, as the name, implies - high speed. I think it may even be a bit too high speed if you have no experience with MVC architecture and you're coming over from the WebForms paradigm. It can be confusing and there's not much info here to really iron out that confusion. It wasn't a problem for me, but I could see how someone new to the MVC paradigm might still be a little uncomfortable by the time they reach the end of the first section.
The second section, Journeyman Techniques, is where the book really starts to shine. This is where the authors get into topics like domain modeling, extending the controllers and views and using Ajax. IoC is covered briefly in this section as well. The reason I find this so valuable is that I like reading books that are less a reference about the tool and more a real-world guide for usage. That's exactly what this section of the book does. Instead of just covering the features of MVC, this book gets into how developers should leverage the ASP.NET MVC framework in their own applications. The chapter on custom model binding and value providers was very useful, as was the chapter on using IoC to create a custom controller factory - these are things that Microsoft might not tell you to do, but will quickly prove valuable if you work on a real-world, large ASP.NET MVC project.
The third section, Mastering ASP.NET MVC, takes things even further with chapters on routing and making your controllers lightweight. There are also chapters on doing mapping with AutoMapper (Jimmy Bogard, who created AutoMapper, is an author of the book) and data access with NHibernate. I could see some people being put off that tools are being suggested as part of the book, but again, I find this refreshing. The book becomes more valuable than just as a reference of ASP.NET MVC features. This is where the real value of the book is. You get information on not just how to build an ASP.NET MVC application, but how to build a rock solid, well-factored ASP.NET MVC application. Even if you don't choose the specific tooling and stuff they suggest, the ideas behind them are sound - such as keeping your controllers lightweight for easier maintainability and testability.
The final section, Cross-Cutting Advanced Topics, closes the book with some information about testing your applications and customizing Visual Studio for ASP.NET MVC work. There's also a final chapter that's a short example of tying everything together which I felt was a little TOO short to be of any value. But the chapter on testing is good as is the route debugging chapter.
Besides the quick introduction to the MVC pattern, I think this book really shines. There is a lot of helpful information and it's great to see a book on the framework that gets into how developers can and should use it in their projects, rather than just being a reference. I like that the book is opinionated and lets you know how real programmers are working with the framework, including how they're working around some of the weaker parts of the framework's default implementation.
I'd suggest this book to someone who understands the MVC architecture, but wants to work on an ASP.NET MVC project and is wondering what the best practices in the field are.
Print | posted @ Tuesday, October 05, 2010 2:04 AM