Instant Nancy Web Development – A book review

I got an email a couple of weeks back from the publisher of “Instant Nancy Web Development” (by Christian Horsdal (@chr_horsdal) asking if I’d review a new book they were publishing on Nancy web development.

It didn’t pique my interest, not because of the subject matter, but because of the horror stories I’d seen around the web regarding both the quality of their books along with the way they treat their authors and reviewers.

I first became aware of Packt when they got into the habit of asking me to both work for free (sorry, for the pleasure of seeing my name in print) or occasionally to write books about things that I only had a passing grasp of.

Suffice to say, getting yet another email asking me to work for the reward of “a 7 eBook” isn’t normally the start of a pleasant experience, but this time it was a topic particularly close to my heart. Regardless, consider this full disclosure – I’m also fairly sure this isn’t the introduction their marketing department was hoping for. Good material rises to the top naturally, and I oppose this kind of paid-for marketing.

I like Nancy as a framework, and adopted fairly early in its life for real software (I’ve gone into that in detail previously) – I use it about as much as I use ASP.NET MVC, and I know it pretty well. I’m no expert, but I’ve used it a fair bit in anger. With that said, I’m not this books target audience. I went in having already read @philliphaydon‘s review, so I had a little context, and I cut through it in two sittings.

Firstly, the good – I enjoyed the tone of the book, it felt approachable and light, pitching itself as a getting started guide. The preface is decent at explaining why Nancy exists, though suffers a little from waffle and repetition – though no more so than other first books.

The structure is approachable, each chapter dealing with a single recipe with code and tests shown along with the downloads, and for the most part the examples are clear and easy to follow.

There are a couple of especially good examples that are worth calling out – custom accept types and content negotiation (where I learnt things I’d not run into before) and the section about enabling Razor views were especially well baked.

Each chapter builds on the last and the author explains the progression between them clearly. As a series of examples that you can build on, A+, would recommend.

The bad – the focus on examples is a little bit of a double edged sword really. The book reads like a well thought out series of blog posts, but lacks a sense of narrative or direction. Reading through it, I couldn’t help but feel that at no point had the general anatomy of a Nancy app really been explained.

Concepts are introduced and reinforced with examples, but you’re expected to pick up the why on the way. As a result, when the book does start pushing test first development (which is obviously a good thing) or dependency injection, it feels out of place from the steady canter of test example, test example. Notably, at one point the book spends a couple of paragraphs discussing testing on AppHarbour, which felt like a total tangent at the time, coupled with the logging example featuring especially verbose tests and delving a little too deeply into NLog.

There were also a couple of things I picked up in the examples that’d probably cause issue – copying views to output locations is a gotcha if you want to quickly host your existing app in IIS, and the default self host example neglects to point out that you can have Nancy do URL reservation rather than shelling out to the command line.

If anything, this is a book that feels like it wanted to be bigger than it ended up. There’s good narrative material on TDD, logging and explaining the need for Nancy, but it just felt like it was missing the cohesion and guidance to hold it together as more than a rock solid set of examples. If there were to be a second edition, I’d love to see the author share more about how he prefers to structure applications that use Nancy, rather than just focusing on “what works”.

The ugly – Kindle formatting. I read though the book on a Nexus 7 with the Kindle app, and the formatting for tablets is a bit of a mess. Formatting code is never going to be pretty on eReaders, and the code itself is no better or worse than other technical books, but I spent a couple of minutes confused during the introduction that explained that attention would be called to specific areas of the code using bold. Which looked exactly like regular text to me. I suspect I’d have a better experience reading the PDF, but you live and learn.

An aside – should this book not be a pull request? Reading through, I couldn’t help feeling like I was reading a more awesome version of the official Nancy documentation. Nancy is open source, and community built, and while holding my 7 eBook, I repeatedly found myself feeling that “this would make a much better default example that the example on the GitHub wiki”. It’d be interesting to see if this book, or its examples could somehow be merged and canonised – and grown by the community much in the spirit of the framework itself. I have no issue with people being paid for work, or spending time writing something to sell, but the focus on recipes here just felt almost too much like “the awesome documentation people don’t quite have time to write”.

Conclusion – Well, firstly, I’m glad this book exists and I enjoyed reading it and can recommend it. It’s a solid first book, and manages to make that leap from “blog series to book” decently. It’s short enough to not be intimidating, it’s friendly and especially suited to beginners, and is another avenue to promote a great open source framework to people who perhaps would discount something as being “not quite ready” if all they had available were wiki pages. It reads well, you’ll learn something, and if you want a quick 0-60 into the “how” of building applications with Nancy, it’ll suit you well. If you’re looking for the “why”, you might be left wanting.

Leave a Reply