Monthly Archives: October 2008

Book Review: Practical Django Projects

James Bennett, the release manager for Django has written a book called Practical Django Projects. At 237 pages, this book is even shorter than Learning Website Development with Django. Miraculously, Bennett manages to pack even more content into his book. He uses three different projects to illustrate the basic concepts of using Django. Early on in the book you are introduced to Django’s generic views mechanism, which makes it very easy to do the kinds of displays that are common in many web applications. Along with generic views, there’s a good treatment of how to keep functionality separated and reusable by good design of URLs. There’s also a much stronger treatment of the templating aspects of Django. He covers template inheritance, but also covers the creation of custom template tags.

Like “Learning Website Development with Django”, “Practical Django Projects” was completed before Django 1.0 shipped, so there are going to be some differences between what is described in the book and what you’ll encounter with Django 1.0. I like both books, and I’m probably biased by the order in which I read them. Either book would be fine for someone learning Django from scratch, but I think that “Practical Django Projects” is the book that I would turn to first when I couldn’t recall how to do something. In addition to the extra topics covered (and that’s not entirely fair because “Learning Website Development with Django” also has a few areas that it covers better), there’s more of an application building focus in Bennett’s book. That emphasis appeals to me, and Bennett has lots of application architecture hints sprinkled throughout the book.

Django is a great piece of work and deserves very serious consideration by people looking to build web applications. I’m glad to see that publishers are getting Django books out into the world.

Retry: Dynamic Languages for Desktop Apps

Apparently, I wasn’t very clear in my previous post, because almost all of the commenters seem to think that I was talking about using a dynamic language to script parts of a desktop application. That’s not at all what I mean. I think that it will be a success point when a dynamic language (I don’t care which one) is used to write a substantial portion of a desktop application that enjoys reasonably widespread success/distribution. I used Lightroom as my example because that’s the kind of application that is the target. While 63% of the code written by the Lightroom team is in Lua, only around 40% of all the code in the application is written in Lua. I am looking for a much higher percentage. I don’t have quibble with Lightroom’s percentages, because it’s very sensible for Adobe to reuse their C/C++ code for RAW processing etc, and there’s no commercial justification for even trying to rewrite that code in Lua.

We already know that dynamic language interpreters can be embedded in applications. That’s been happening for years and years. But since we are starting to see progress in the performance of dynamic language runtimes, it should be possible to write really good desktop applications using them.

Lua in Lightroom

One of the points that I discussed in my PyConUK keynote was the role (or lack thereof) of dynamic languages in desktop software development. I know that some people believe that desktop software is dead, but I am not one of them. I think that the nature of desktop software is changing, but that it is still relevant. In my discussion of dynamic languages and desktop software, I used the example of Adobe’s Lightroom, as the best example of commercial software that is written in a dynamic language. Lightroom is written in Lua, and according to this presentation by Troy Gaul, 63% of the code written by the Lightroom team is Lua (there is a bunch of C code for the low level image processing code, which is shared with Adobe Camera Raw). A number of people at PyConUK had no idea of the role of Lua in Lightroom, which is unsurprising. The only reason that I knew was that I was following Lightroom as a photography nut, and the information flew by on some boards. Troy’s presentation is pretty illuminating, so if you are interested in dynamic languages in desktop applications, you should watch the whole thing.