Professional ASP.NET MVC 3 has been available on Amazon for a few weeks now. It's had a pretty wild ride so far, including being listed as the top selling book Programming book on Amazon, followed by the Kindle version in second place. For a few crazy days, it was one of the top 1000 books across all of Amazon - take that, Herman Melville!
The print version sold out on Amazon for a while, but has been in stock again lately (in the US, international coming soon). The Kindle version, of course, is always available, and you can also buy a DRM-free e-book directly from Wrox.
If you haven't bought the book yet, here's a little background on why - in my subjective opinion - I think you should. :-) Oh, and if you get bored, skip to the end for a hint on how to win a copy of the book...
All New Content
A lot has changed since MVC 1 shipped, so we decided it was time for a cover-to-cover rewrite. While we kept a (very) few bits and pieces from the previous books, we started from scratch and took a fresh look at everything:
A new table of contents
We looked at feedback from the previous versions, how we wanted to communicate about MVC based on several cumulative years of speaking/teaching/writing about it, and decided to start with a completely new table of contents. Among other things, we decided that, as of version 3, there really wasn't a need to "sell" MVC as an alternative to Web Forms anymore. We feel like developers are clear on the differences, and when they buy a book about ASP.NET MVC it's because they're ready to learn it, so that's the entire focus. Take a look at the table of contents [pdf] to see what I mean.
Samples built around MVC Music Store scenario
We felt like we could improve the flow of the book by, when possible, basing our samples on the MVC Music Store scenario (I write and maintain the MVC Music Store tutorial). Previous versions of the book used new scenarios in different chapters: Nerd Dinner, blog systems, car painting systems, product catalogs, and foo-bar-baz-hello-world pseudo-apps. We thought that it was a bit distracting and inefficient to introduce new scenarios over and over, so our default was to build from a common scenario using the MVC Music Store. There are a few exceptions when we thought it was simpler to use a different scenario, but when possible we standardized our code examples around adding features to the MVC Music Store tutorial.
The previous versions of the book started with the 165 page Nerd Dinner tutorial, two chapters explaining how ASP.NET MVC fits in with ASP.NET and Web Forms, followed by a chapter on routing. It wasn't until 243 pages into the book when you hit the Controllers chapter. Then things got a little repetitive, because many concepts were introduced in the Nerd Dinner tutorial and filled out in more detail in the respective chapters (e.g. routing was explained in the first chapter and fleshed out in the Routing chapter).
I think that made a lot of sense at the time - I made heavy use of the MVC 1 book when I was getting up to speed, and really liked it. However, as ASP.NET MVC has been out for a while and many ASP.NET developers have at least a general idea of how it works, we felt like there were a lot of advantages to doing things in a with a single pass. This really streamlined the start of the book - for instance, you get to Controllers (a very important concept in ASP.NET MVC) a lot quicker - page 23 instead of 243. The chapters explaining why ASP.NET MVC was created and why you should care have been pretty much eliminated; what we kept was reduced to a minimum of context and introductory material in the short Getting Started chapter.
"Partnering with" rather than including an end to end tutorial
When ASP.NET MVC was first released, the Nerd Dinner tutorial was a one of a kind resource that helped introduce hundreds of thousands of developers to ASP.NET MVC as well as a lot of important concepts - even, for instance MVC as a design pattern. There really wasn't anything like it, and including the Nerd Dinner walkthrough with the book was really helpful.
There are some tradeoffs, though. Including a 165 tutorial which can be freely downloaded as a PDF in a paper book means that pages, editing time, attention, etc. are diverted away from other book content.
Also, printing a long walkthrough on paper is asking for problems - a one character typo (either by the reader or in the book) can really throw a new learner, updates are only via errata, and framework updates (e.g. the MVC 3 Tools Update) aren't reflected once the book is printed. Massive, step by step tutorials are much trickier than individual code samples, since any errors (again, in the book or by the reader) don't compound. It's for this exact reason that I publish ten "checkpoint" code drops for different sections of the MVC Music Store - if you get lost at any point, you can see the expected state snapshotted at the end of each chapter of the tutorial.
So we decided that, since the 135 page MVC Music Store tutorial application is freely available both as a PDF download and online and is updated several times a year, it was better to refer to it and devote the effort to writing other content that wasn't freely available online. As a reader, you get more content which is best suited for book content, and if you want to make use of the MVC Music Store tutorial to get more of a beginner-level introduction to certain topics, it's available.
New authors, new chapters
Phil and I have worked on previous versions of the book, but for this version we were thrilled to add two new authors: Brad Wilson and K. Scott Allen.
- Brad Wilson is not only an ASP.NET team member, he's also co-author of the xUnit.net unit test framework. He wrote new chapters on Dependency Injection and Extending MVC, and rewrote the Unit Testing chapter. Brad's a pro at explaining advanced concepts, as demonstrated by his Advanced MVC 3 presentation at mvcConf (the most viewed session of the entire conference at over 76K views and counting!) and his new Full Throttle TDD series on TekPub (quoth Rob Conery, "Wow. @bradwilson's TDD video is the fastest-selling title we've ever had. Good grief!"). Brad is a new author, but was one of the Technical Editors for the MVC 2 book, which was a great advantage in planning this version.
- K. Scott Allen is an all around ASP.NET ledged as well as a seasoned author. He wrote new chapters on Models, Data Annotations and Validation, Forms and HTML Helpers, and Ajax. K. Scott is the instructor for the hugely popular Pluralsight MVC 3 course, and also happens to be a co-host with me on the Herding Code podcast.
- Phil Haack covered Views, Routing, and NuGet.
- I covered Getting Started (including what's new in MVC 3), Controllers, and Securing Your Application.
When we were done, we had a lot of great content that - while interesting - didn't fit into the overall flow of the book. We decided to add an Advanced Topics chapter, which allowed us to be a little ruthless in removing content from earlier in the book.
Additionally, we had Eilon Lipton on board as the Technical Editor. Eilon gave us some fantastic advice, not just on technical issues, but in seeing the big picture as well. He often pointed out places where we were digging into minutia that nobody would care about or missing important questions that needed answering.
Code Samples via NuGet
As Phil explained in his post, we decided to use NuGet for the majority of the sample code. That means that, instead of downloading (and unzipping, and unblocking, etc.) sample projects, you can just install samples directly via NuGet. In addition to be easier for readers, we'll be able to update them as needed using NuGet.
Electronic versions: surprisingly good
The conventional wisdom is that technical books aren't very readable on Kindles, but we were happily surprised to see that wasn't the case at all. Here are a few screenshots, courtesy of Thiago Temple.
(these are shrunk down, click through to see larger pictures)
What I'm happiest about
Keeping focus on the big picture
Writing a technical book is a ton of work. To make matters more complex, the authors are often pretty busy around the time of the product release - in this case we had Phil and Brad actually building ASP.NET and NuGet, me working on MVC Music Store and other content for release, K. Scott producing videos and travelling the globe training. That means there's a lot of pressure to meet the book schedule while working very late nights, weekends, etc.
The challenge is to keep the quality high, so when the book actually ships it's something you're happy with. Actually, this is a problem with a lot of high pressure tasks - you can get so focused on the mechanics and details of not messing something up that you end up missing the bigger picture. We did a few things there which in my opinion really helped out.
The big rewrite
First, we made the hard call to basically rewrite the book right at the beginning. There's tremendous inertia once you've got content that's been through the editorial process to just revise rather than make major changes. Similar reasons, come to think of it, for why legacy software rarely gets that big rewrite that everyone dreams about but can't justify. Somehow, Phil and I convinced each other that a rewrite was a good idea.
The problem is that a big effort like that takes a lot of time, which was only feasible with some more authors - and good ones.
Rounding up good authors
I've already talked up Brad and K. Scott earlier, but getting them on board was a huge part of making this book happen. If Phil and I hadn't
tricked talked them into this, there's a good chance the book wouldn't have happened. It was great to work with such an amazing team.
We were running on schedule. Things were nearly done: we'd wrapped up all our first drafts and were just working through edits from technical and editorial review. Light at the end of the tunnel and all that.
But something didn't feel right. We'd all agreed on the table of contents, conferred with each other when we had questions on how to present something, etc., but I was worried that the book might feel like a collection of chapters written by four separate authors. Four voices was fine, but the book needed to be cohesive. So we agreed to dedicate one week to peer review on the chapters - each author would be assigned chapters by other authors, and was free to review more if they had time. I convinced the publisher that this was a good idea, which is pretty cool considering that this was a bit of a risk. I'm so happy we did this - I got some amazing feedback on my chapters, feel like my feedback for other authors was worthwhile, and we were able to make sure the flow of the whole book was cohesive and covered what we wanted it to. At the very end of the book cycle, I stayed up really late one night and read the book cover to cover, and was really happy with the result. This may seem incredibly obvious, but from what I've seen of publishing it's rare that there's any time in the schedule for a thorough peer review.
Securing Your Application chapter
I'm happy with all the chapters I worked on, but my favorite is the "Securing your application" chapter. I really struggled with how best to organize things so it would be interesting and worthwhile. There was some great existing content from Rob Conery's Security chapter in the MVC 1 version of the book, but I wanted to restructure it and pull in security / authorization tasks as well as threat / response. I spent a good amount of time reviewing threats on OWASP, ran some things by experts like Barry Dorrans, and ended up happy with the result. I hope you are, too.
We've had a lot of feedback since the book released, and we're really open for ideas to improve future versions of the book. Here are the two main requests we've seen so far:
- More advanced content
- Practical content on things like deployment and solution architecture
Got any ideas? We've been thinking about a range of things, from adding some new chapters to restructuring a bit to add more "cookbook" style content. Thoughts?
Win A Copy?
I have a few promo copies to give away. I had fun giving a few out at devLINK via a hide and seek game, and that got me thinking it would be fun to do a hide and seek on the internets to give away some more copies. Watch my blog and follow @WroxMvc3Hunt on Twitter for more details...