With the launch of MVC 2.0 just gone and my commercial use of ASP.NET gathering pace, I wanted to read an in-depth book on the topic having already read a beginners book on MVC 1. Additionally, I was well up for finding out all the cool new features in MVC 2.0.
It seemed like a straight fight between Wrox – with a host of Microsoft employees, and Apress – with the much lauded Steven Sanderson.
In the end, my decision was made by the fact I read Steven Sanderson's Blog (which I have learnt a lot from – including that Steven Sanderson is a very smart boy), I’d watched the Tekpub - Mastering ASP.NET MVC 2.0 series which he expertly contributed to, and the Amazon reviews which loved version 1 of the book.
Chapters in the book
Initially, Steven looks at the wider web development community and the need for ASP.NET MVC. Even going all the way back what he labels the “Jurassic” period of Microsoft’s web development technologies – in reference to “Common Gateway Interface (CGI)”. This brief overview also mentions other platforms like Ruby on Rails and Java RMI.
Steven is also keen to point out the flaws in Web Forms, not quite how aggressively Rob Conery is in some of his blog posts, though.
Once the initial discussion is out of the way, over the following 5 chapters a couple of applications are created which you can either follow along with or create yourself. Even for myself, who has experience of ASP.NET MVC, these initial applications still brought to the surface tricks and techniques I was totally unaware of. Basically, there is still a lot of benefit from reading them whether this is your first exposure to ASP.NET MVC or not.
From the first bit of code that is written, Steven throws up the topic of unit testing, but clearly delineates these sections of the book with special headings – so if you don’t care about unit testing you don’t need to read them. If you do read them, you will get your reward though. Steven will show how you can test all aspects of your application, including situations where you need to mock HttpContexts or simulate an online environment.
Following the initial chapters, the meat of the book sees in depth discussions on models, views, controllers and routing, all with examples to show how they should or can be used.
A stand out feature of the book for me is the sections on views – specifically the template helpers. I think, used judiciously, helpers can keep your views clean and object-renderings centralized. Steven goes into enough depth to allow you to do this with full confidence and maximum benefit.
Another great feature is how ASP.NET MVC’s extensibility is emphasized and accentuated. A few examples would be building custom model binders, custom value providers and custom data annotations – all taught superbly well and made to look very easy.
Steven also serves himself well with his section on routing. Here he teaches how to clean up url’s for all the reasons you would want to – aesthetics, SEO friendly, semantic etc
As you would also expect as web developer, this book talks about client-side features. And you guessed it; JQuery makes an appearance here along with all the AJAX features provided by Microsoft.
The final chapters in the book cover deployment – including web.config transformations which can be very useful, security and platform features such as ASP.NET providers. Again, all of these chapters are very informative.
Other good features of the book
As a reference book, this does an excellent job; commercial projects at work and redeveloping my web site at home have proved this. The only problem is carrying it everywhere with me (small potatoes).
As I knew from his blog, which is also true of this book, Steven comes across as a smart and friendly guy and due to his writing style which is true to this, I found I absorbed the information very easily. I still made my customary notes, but when reading them back, I felt I had retained most of the information anyway.
All through the book there are a little tips and tricks, either hidden in the framework or Steven’s own way of doing things. One example is the fluent-interface-using-lambdas data validation technique which is seriously cool… but does take a bit of getting your head round when understanding how it works.
I have got to say one more thing about this book, and that is spelling and grammatical errors – he did such a great job of writing this book he left them out!!!!!
Pro ASP.NET MVC 2 Framework is a masterpiece of an educational resource for ASP.NET MVC 2. From the smooth and intelligible style of writing, to the in-depth knowledge and reference to Http specification requirements, Steven Sanderson has taught me well and given me a book that I can dip in and out of when I need assistance at work.
The lack of grammatical errors and spelling mistakes also highlight that Steven Sanderson is diligent as well as smart.
I would, without doubt, recommend to anyone who came asking me how they could learn ASP.NET MVC 2 – providing they knew C# and web fundamentals.
Don’t forget to check out Steven Sanderson's Blog.