Bernie Cook's Blog

Azure, C#, .NET, Architecture & Related Tech News

Book Review: “Professional ASP.NET MVC 4”

Leave a comment

Professional ASP.NET MVC 4A few months after the official release of MVC 4 I decided to go hunting for an MVC 4 book that was less of an introduction to MVC 4 and written more for the seasoned MVC developer. I’d recently delivered an MVC 3 solution so was looking to work my way through a MVC 4 book that was (a) written by some respected authors, (b)  would provide a comprehensive guide to the latest iteration of this particular framework, (c) draw attention to those features new to version 4, and (d) provide a structure that easily permitted me to skim over the more familiar concepts.

So I did some research and ended up purchasing Wrox’s Professional ASP.NET MVC 4 by Jon Galloway, Phil Haack, Brad Wilson and K. Scott Allen. Having recently finished it I thought I’d share a review for the benefit of those who are in a similar situation to myself several months ago.

In short I’d give this book a 4/5. Most of the chapters were written exactly as I’d hoped, with the exception of a few which definitely had the feel like they were rushed out the door or were getting a touch off topic. Less the index and ads this is a 440 page book with the topics being divided up logically between the four authors.


A chapter by chapter summary is provided below.

I have to add that I also complemented my reading of this text with a number of MVC 4 articles posted from the official ASP.NET website, as well as a variety of other sources (author’s blogs, Pluralsight tutorials, etc.), so any critiquing or complements is a result of comparative reviews on similar topics and/or just me bringing my personal experience to bear (which I’ve kept to a minimum … promise :)).

1. Getting Started

The book starts off with a general overview, history and guided walkthrough of the ASP.NET MVC framework and it’s related technologies. A good start as you’re immediately versed with the problems addressed by the MVC framework and are given a broad view of the environment it operates within. If you’re new to MVC, or a less experienced .NET developer, you’ll be introduced briefly to a number of new concepts such as unobtrusive AJAX, Web API, bundling and minification, etc. – don’t be scared off though, these are covered in more depth later in the book.

2. Controllers

This chapter covers controller basics, setting the reader up for the complexities to follow in later chapters. The place of a controller in discussed and illustrated by example in among other important MVC concepts; models, views and the routing subsystem. Certain terms such as ActionMethods and ActionResults are covered, and a brief mention of some side topics such as IIS Express and the MVC Music Store tutorial application are made.


The role of a view and all of the expressions, syntax and calls that come with generating, for the most part HTML, is covered in this chapter. Generally speaking there is a lot of individual view-specific knowledge to gain and this chapter focuses on all of the essentials; Razor syntax, ViewBag (ViewData), encoding, iterators, code blocks, layouts, partial views, etc. and very importantly how a controller and views work together.

4. Models

This is a very hands-on chapter that leads the reader through a number of MVC models – they’re construction, integration into a sample solution, use of scaffolding, model binding and their wider context within the application’s domain. Some very simple yet highly practical architectural guidance is offered as well (unit of work and repository design patterns – some personal favourites of mine) and important data retrieval concepts (eager loading, lazy loading, etc.). Quite a bit of Entity Framework ground is covered so by the end of the chapter you’ll be well versed in a number of it’s key features and benefits.

5. Forms and HTML Helpers

The chapter starts off with a rehash of all things <form> – after all you have to be acquainted with the important fundamentals of one of the key HTML components if you want to get closer to the metal with MVC. Shortly after the author reviews an array of HTML helpers; strongly-typed helpers, templated helpers, how they work with your models (state and validation), and coverage of the essentials: Html.ActionLink() through to Html.RenderAction(). A lot of very useful tips are provided.

6. Data Annotations and Validation

A solid introduction to data annotations, covering both the pre-built ones (Required, StringLength, Compare, Display, etc.) as well as walkthrough on how to construct your own whether it be for individual attributes or to address an entire model. The relationship to model binding and and model validation is also covered, helping to clarify the relationships between these two fundamental MVC elements. A minor note is that I was slightly surprised to see no mention of [AllowHtml].

7. Membership, Authorisation and Security

As the title suggests it covers the main security topics facing any web developer, with a particular focus on the field of ASP.NET MVC. Even if you have had little or no experience with addressing a web application’s security requirements this chapter will walk you through everything from the recommended mindset to adopt right down to examples of specific .config settings and action method attributes. As a side I don’t think the AntiXSS library has been received as well as the author made out in the chapter, but he does mention an alternative approach to addressing those infamous XSS attacks.


Learning about asynchronous JavaScript and XML isn’t the only topic this chapter covers, you’ll get a guided walkthrough of a variety of related tools and frameworks; jQuery, unobtrusive JavaScript, client-side validation, AJAX helpers, Modernizr, mustache, JSON, CDNs, bundling and minification, etc. Some are covered in more detail than others and you certainly won’t be an expert by the end of the chapter but you will definitely be more informed of the array of tools available when working on your views.

9. Routing

There’s about a dozen fundamental concepts that you need to grasp so that you can take advantage of the functionality provided by MVC routing, all of which are covered by the author Phil Haack (who wrote the very handy RouteDebugger)  in a very clear and well illustrated manner before he moves onto some advanced routing topics. There are plenty of examples so you won’t be left guessing as to what a given route configuration does. As a side I’d be remiss if I didn’t recommend you compare RouteDebugger with Glimpse as the latter is definitely the more powerful of the two.

10. NuGet

Thanks to NuGet the hours spent managing external libraries are a thing of the past. Every .NET developer worth their salt relies quite heavily on NuGet these days and for good reason. Haack spends roughly 30 pages explaining the benefits of NuGet, how to interface with the tool, references a few points of interest as to how best utilise NuGet and it’s packages within a solution (and source control solution whether that be TFS or DVCS’s like Git and Mercurial), and then ties it all up with a step-by-step guide on creating and publishing your own NuGet packages. I couldn’t help but feel this chapter was a little off topic for a book on ASP.NET MVC but it’s a point worth driving home for those MVC developers who haven’t been introduced to NuGet yet.


Without sounding overly negative I was quite disappointed with this chapter, Web API is such a great feather in the MVC 4 cap and I really don’t think the author did it justice. If you compare the content in this chapter, and how it’s presented, with several similar Web API articles at ASP.NET you’ll see what I mean. By the end of the chapter I felt like I’d wasted my time and went elsewhere to get my Web API fix.

12. Dependency Injection

This chapter starts off strong, clarifying some relatively complex programming concepts in a short space. Admittedly it must be hard to cover all the dependency injection (DI) topics such as inversion of control, service locators, DI containers, 20 pages but the author makes a good attempt in the first half. After that things pretty much go down a heavy theory-based track, without any properly grounded examples. Unfortunately you won’t come away from this chapter and be able to sit down and wire up a DI container like Ninject but you will have a solid grasp of the fundamentals and understand the importance of implementing DI. (I’d recommend “Pro ASP.NET MVC 3 Framework” if you want a more comprehensive, and hands-on coverage, of MVC and DI – Steve Sanderson does it justice in that particular book)

13. Unit Testing

Overall not a bad chapter. Some key testing concepts and methodologies are raised and explained quite well. For those new to unit testing this will certainly be of benefit but will act more as a stepping stone than a go-to guide for testing. Entire books have been written on unit testing so it’s hard to pack that amount of knowledge into  30 or so pages.

14. Extending MVC

This chapter drives home the important point that a lot of what you take for granted with the MVC Framework; the Razor view engine, model binders, Html helpers, filter attributes etc. are simply what you get out of the box and are relatively easy to replace or extend. A number of particular areas of extensibility are focused on (relating to models, views, controllers) with several short examples that, although they aren’t overly comprehensive, do help to get the point across and get you started. Again this chapter doesn’t provide a directed, practical link to real-world solutions so you’ll have to go off and do a bit more reading and tinkering before you get ou want to go. However, some of these topics are quite involved so it’s unrealistic to expect a comprehensive coverage.

15. Advanced Topics

The most lengthly chapter, and most diverse. All of the topics covered are relatively advanced with a few bordering on quite easy so don’t be too intimidated.

16. Real-World ASP.NET MVC – Building the Website

Although this chapter isn’t 100% MVC it does provide you with an insight into how a existing, and very popular, Azure hosted MVC solution was constructed focusing most of it’s attention on the array of NuGet packages it employs to run everything from the error logging to the DI container wiring. If I were preparing a final MVC chapter I probably would have opted for a something more closely tied to MVC, perhaps walking through the major elements touched on in previous chapters. Having said that the chapter does drive home that point that NuGet is your friend and the array of packages available can power a significant portion of your MVC solution if you so wish … and once the packages are configured of course 🙂


Haack starts off the final chapter with an apt statement; “To learn a framework such as ASP.NET MVC, read a book. To learn to use the framework to build a real-world application, read some code.” For the most part this MVC 4 text by Wrox does just that, helping you to understand the MVC framework. But, like Haack says, you need to put yourself in front of some MVC code, and just as importantly, you’ll need to start building some practical applications to really be proficient at MVC 4 in the workplace. MVC 4 is too complex a topic to address in a single book so don’t expect to finish this particular text and build an MVC 4 solution end-to-end.

For me this book did a decent job at serving it’s primary aim – I’m far more familiar with the newer features offered by MVC 4, how to implement them (with a little side reading at times), and was able to breeze over the more familiar topics when they presented themselves.

At the time of reading I was working on a wireframe for an upcoming MVC production system and would find myself getting sidetracked as I’d read about some new MVC 4 feature which I knew would compliment the end solution. When I had the chance I’d find myself buried in Visual Studio 2012 constructing a working prototyping that utilised said MVC 4 feature in preparation for the development stage. Coding with MVC 4 is incredibly satisfying and a great development framework with which to construct ASP.NET solutions. Reading through this text made me wish I was just a senior dev at times with no project management and architectural responsibilities to attend to … well only just, they’re all enjoyable roles.


Author: Bernie

I currently live and work in the UK, just outside of London. I've been working in IT for 15+ years and in that time have solved many technical problems via blogs, forums, tutorials etc. and feel like I should be giving something back. This blog post is my way of contributing and I hope it proves just as useful to others as their contributions have to me.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s