Book review: Professional ASP.NET MVC 5. Is this the way to learn ASP.NET MVC?

This book caught my eye because while I like ASP.NET MVC, Microsoft’s modern web application framework, it seems to be badly documented. Even the word “badly” is not quite right; there is lots of documentation, some of high quality, but finding your way around it is challenging, thanks to the many different pieces involved. When I completed an ASP.NET MVC project recently, I found it frustrating thanks to over-reliance on sample projects (hey, here is a an application we did that works, see if you can figure out how we did it), many out of date articles relating to old versions; and the opposite, posts and samples which include preview software that does not seem wise to use in production.

image

In my experience ASP.NET MVC is both cleaner and faster than ASP.NET Web Forms, the older .NET web framework, but there is more to learn before you can go ahead and write an application.

Professional ASP.NET MVC 5 gives you nearly 600 pages on the subject. It is aimed at a broad readership: the introduction states:

Professional ASP.NET MVC 5 is designed to teach ASP.NET MVC, from a beginner level through advanced topics.

Perhaps that is too broad, though the idea is that the first six chapters (about 150 pages) cover the basics, and that the later chapters are more advanced, so if you are not a beginner you can start at chapter 7.

The main author is Jon Galloway who is a Technical Evangelist at Microsoft. The other authors are Brad Wilson, formerly at Microsoft and now at CenturyLink Cloud; K Scott Allen at OdeToCode, David Matson who is on the ASP.NET MVC team at Microsoft, and Phil Haack formerly at Microsoft and now at GitHub. I get the impression that Haack wrote several chapters in an earlier edition of the book, but did not work directly on this one; Galloway brought his chapters up to date.

Be in no doubt: there are plenty of well-informed ASP.NET MVC people on this team.

The earlier part of the book uses a sample Music Store application, a version of which is publicly available here. You can also download a tutorial, based on the sample, written by Galloway. The public tutorial however dates from 2011 and is based on ASP.NET MVC 3 and Visual Studio 2010. The book uses Visual Studio 2013.

Chapters 1 to 6, the beginner section, do a decent job of talking you through how to build a first application. There are chapters on Controllers, Views, Models, Forms and HTML Helpers, and finally Data Annotations and Validation. It’s a good basic introduction but if you are like me you will come out with many questions, like what is an ActionResult (the type of most Controller methods)? You have to wait until chapter 16 for a full description.

Chapter 7 is on Membership, Authorization and Security. That is too much for one chapter. It is mostly on security, and inadequate on membership. One of my disappointments with this book is that Azure Active Directory hardly gets a mention; yet to my mind integration of web applications with Office 365 (which uses Azure AD) is a huge feature for Microsoft.

On security though, this is a useful chapter, with handy coverage of Cross-Site Request Forgery and other common vulnerabilities.

Next comes a chapter on AJAX with a little bit on JQuery, client-side validation, and Ajax ActionLinks. Here is the dilemma though. Does it make sense to cover JQuery in detail, when this very popular open source library is widely documented elsewhere? On the other hand, does it make sense not to cover JQuery in detail, when it is usually a vital part of your ASP.NET MVC application?

I would add that this title is poor on design aspects of a web application. That said, I was not expecting much on the design side; but what would help would be coverage of how to work with designers: what is safe to hand over to designers, and how does a typical designer/developer workflow play out with ASP.NET MVC?

I would also like to see more coverage of how to work with Bootstrap, the CSS framework which is integrated with ASP.NET MVC 5 in Visual Studio. I found it a challenge, for example, to discover the best way to change the default fonts and colours used, which is rather basic.

Chapter 9 is on routing, dry but essential background. Chapter 10 on NuGet, the Visual Studio package manager, and a good chapter given how important NuGet now is for most Visual Studio work.

Incidentally, many of the samples for the book can be installed via NuGet. It’s not completely obvious how to do this. I found the best way is to go to http://www.nuget.org and search for Wrox.ProMvc5 – here is the link to the search results. This lists all the packages available; note the package names. Then open the Nuget package manager console and type:

install-package [packagename]

to get the sample.

Chapter 11 is a too-brief chapter on the Web API. I would like to see more on this, maybe even walking through a complete application with clients for say, Windows Phone and a web application – though the following chapter does present a client example using AngularJS.

Chapter 13 is a somewhat theoretical look at dependency injection and inversion of control; handy as Microsoft developers talk a lot about this.

Next comes a very brief introduction to unit testing, intended I think only as a starting point.

For me, the the next two chapters are the most valuable. Chapter 15 concerns extending MVC: you learn about extending models with value providers and model binders; validating models; writing HTML helpers and Razor (the view engine in ASP.NET MVC) helpers; authentication filters and authorization filters. Chapter 16 on advanced topics looks in more detail at Razor, routing, templates, ActionResult and a few other things.

Finally, we get a look at how the Nuget.org application was put together, and an appendix covering some miscellaneous details like what is new in ASP.NET MVC 5.1.

Conclusions

I find this one hard to summarise. There is too much missing to give this an unreserved recommendation. I would like more on topics including ASP.NET Identity, Azure AD integration, Entity Framework, Bootstrap, and more. Trying to cover every developer from beginner to advanced is too much; removing some of the introductory material would have left more room for the more interesting sections. The book is also rather weighted towards theory rather than hands-on coding. At some points it felt more like an explanation from the ASP.NET MVC team on “why we did it this way”, than a developer tutorial.

That said, having those insights from the team is valuable in itself. As someone who has only recently engaged with ASP.NET MVC in a real application, I did find the book useful and will come back to some of those explanations in future.

Looking at what else is available, it seems to me that there is a shortage of books on this subject and that a “what you need to know” title aimed at professional developers would be widely welcomed. It would pay Microsoft to sponsor it, since my sense is that some developers stick with ASP.NET Web Forms not because it is better, but because it is more approachable.

 

3 thoughts on “Book review: Professional ASP.NET MVC 5. Is this the way to learn ASP.NET MVC?”

  1. You say that “There is too much missing to give this an unreserved recommendation” but you also say that “I would like more on topics including ASP.NET Identity, Azure AD integration, Entity Framework, Bootstrap, and more” and in the same breath say.. “Trying to cover every developer from beginner to advanced is too much; removing some of the introductory material would have left more room for the more interesting sections.” Which is it, do you want them to try and cover a lot of stuff or not? You say that they could do without the first 7 chapters but then you also say “It’s a good basic introduction but if you are like me you will come out with many questions, like what is an ActionResult (the type of most Controller methods)? You have to wait until chapter 16 for a full description”. Seems like those first 7 chapters are needed and maybe the answer is they need to explain more core concepts in those chapters. But if you want a good explanation of what an Action Result is. It’s just a method within a class. If you click F12 while highlighting ActionResult in your code it will take you to the code that makes up the way ActionResult works, but in the end it’s just a special method that gives you additional tools and overloads for controller things. A controller is just a class and a ACtionResult is just a method of that controller. No more, no less. Well, more than less. lol Again it’s some some extra super powers that regular methods don’t have. I think you are trying to have it both ways. You want more information that suits you but all the extra information that more basic programmers want you think they should throw out, but then you say you are one of those basic guys that needs more explanation, which is it?

    1. It is quite simple; I would have left out most of the first 7 chapters, or covered in a brief 1-chapter resume, leaving more space for more advanced material.

      Tim

  2. First off, I want to thank you for publishing my comment. Second I hope you don’t mind that I am taking you to task with the article because I feel the author has to find some common or middle ground in order to write a book that can be useful to many different ASP.NET developers. I agree that the documentation for ASP.NET MVC 5 is not the easiest to find. FOr beginners there is no problem with starting your learning with MVC 4. It’s easier to understand than when you get into MVC 5 and you have the options of async controllers and using interfaces (IThis and IThat). I think you should have a grasp on the basics of MVC 4 before moving to MVC 5. I see nothing wrong with this, there is ample documentation and 90% is transferable to MVC 5. I still recommend that for beginners if they can’t get a hold of a book like the one you are reviewing.

    I have found the Linda.com course called “ASP.NET MVC 4 Essential Training” is a great start to learning MVC.

    Next step I think should be a course like Pluralsight’s – ASP.NET MVC 5 Fundamentals. This second course will pick up where the other left off and give you some high level overviews of what has changed from 4 to 5 which is very good to know. The majority of what you learned in 4 will carry over.

    For complete beginners wanting to start with MVC 5 I suggest watching the Microsoft Virtual Academy’s MVC 5 course with John Galloway titled: “Introduction to ASP.NET MVC” this is more of a hold your hand beginner course which in your case could be the first 7 chapters of this book.

    Finally ASP.NET has a few good tutorials like one that will really help you understand how to work with code first and EF6 called “Getting Started with Entity Framework 6 Database First using MVC 5”

    As for books I’m looking at picking up this book to see what has changed as well there are some new chapters, I also like “Pro ASP.NET MVC 5” I have the digital version which I use when developing simply to look things up with Ctrl+F as I run into problems. It’s an exhaustive MVC 5 book and I can’t imagine reading it cover to cover (753 pages).

    I will agree with this. Someone needs to step up and Make a MVC 5 book that assumes you have the very basics and really digs in deep with a more custom design maybe not even using the application template, building a sophisticated application that incorporates something like Angular and really focuses on taking data from a relational database, packaging it up in json and sending it to the front end for management until it’s ready to be persisted back. This subject is lacking good documentation. Also integrating MVC 5 with Web API is a must to teach because in MVC 6 it will be combined AS IT SHOULD BE. All in all, I thank you for the review and hope that once I get the book I greatly disagree with you! lol

    Cheers!

Comments are closed.