2013-01-19

Two Scoops of Django: book review

Today my boss surprised me with a copy of Two Scoops of Django (alpha version, no print just yet). When I first looked at the book's website, I couldn't locate any excerpts, and I really didn't know what to expect. But then I noticed the reviews posted below the front matter and found out that this is not your average Django book.

Django is by far the most popular python frameworks, and one of the most popular web frameworks in general. It owes its popularity to completeness, robustness, elegant design, and stability. If you ask me, though, the best thing about Django is its documentation. Having said that, it's one thing to know how the tools work. How to use them properly is a completely different thing. Two Scoops of Django is a book that fills this gap. I think this comment summarizes it well:

You know those lessons you learn when projects blow up in your face? This book contains several projects worth of such lessons. -- Lennart Regebro, author of "Porting to Python 3"

Indeed, there were some very painful lessons I have learned over time, and not just at later stages of building Django applications, but also lessons that I should have learned right at the very beginning, when scaffold a brand new project.

It's no news that Django's official tutorial isn't always following the best practices, and while one could argue that the path that lies beyond the very basics is not a single path, one good path is enough for most people. This book might seem opinionated to opinionated people, but for those that are still exploring in the darkness, it's godsent. This is especially true for absolute beginners.

Another reason this book is important is that it covers the almost-released Django 1.5 (still RC1 as of this writing). There is no better way to get started with a new version than with pockets full of best practices.

The book covers all aspects of Django development. From coding style, to organizing your code, to application design basics, to testing, to documentation... It is packed full of useful tips on much more than this humble blog post can enumerate. Each section gives you theoretical discussions, code examples, and, on occasion, remarks about authors' preferences. You can read it as thoroughly or as superficially as you want. The book is composed of more-or-less self contained sections. All of this means that if you are in a hurry, you can skip right to the desired part of the book, use the provided snippets and start exploring on your own. Or, you could come back for some theory behind it all, and gain better understanding of the issue.

So far I've only written positive things about the book. Are there any negatives? Well yes. Only one: I wish I've read it earlier! It does have the tendency to make me feel a bit bad about some of the choices I've made in earlier projects and the potential problems with those choices that this book reveal.

Two Scoops of Django was written by Daniel Greenfield (NASA, O'Reilly) and Audrey Roy (MIT, Microsoft, SugarSync). You might know about their work in form of DjangoPackages, or LA Hackathons.

The book (PDF) is currently still in Alpha stage, and you can get it for a bargain price of $12, so I highly recommend you go and get it. Alpha customers will also receive Beta and final versions.