Monday, February 23, 2009

Review: Python Web Development with Django

Authors: Jeff Forcier, Paul Bissex, and Wesley Chun Format: Paperback, 408 pages Publisher: Addison-Wesley Professional; 1st edition (November 3, 2008) ISBN-10: 0132356139 ISBN-13: 978-0132356138 I have something of a relationship with both Python and Django, the latter because I use Django more or less regularly to contribute my portion of an application (which shall remain nameless for the moment) that my company ("my" in the sense that I work there, not that I actually own anything) is developing. I'm already sold on the relative simplicity and power of Python based on my attempts to hammer away with the language, so this book, at least as far as the topic is concerned, is everything I could ask for. But can the same be said for the content of the book? I was going to say "first things first" and then proceed to the target audience for the book, but there's another point to make before that. The little "button" on the front cover says "Covers Django 1.0". I visited the Django Project and on the download page (as of this morning, February 23rd) it says, "The latest official version is 1.0.2. Here's how to get it". Assuming you want to use the latest version of Django, having a book that presents the latest information (well, as recent as any print documentation can be) is an enormous advantage. As a small aside, the download page also states, "Python version 2.3 or higher" is required, so you don't have to be using latest version of the non-backward compatible Python 3 to use the latest version of Django (of course "or higher" can be interpreted more than one way). The second page of the Preface does something cool, if you aren't sure how much of this book applies to you. There's a little diagram that outlines the four skill/experience levels for readers, and which chapters are relevant to you depending on which level applies to you. "Brand New to Django and Python" starts you off at Chapter 1 which is to be expected, but some Python experience (but no Django) gets you going, starting at Chapter 2. Some experience with both puts you beginning at Chapter 4, and advanced learners can skip ahead to Chapter 11. At least as far as the authors' predictions go, this book has something for everyone. The book has a website, which is more or less expected these days. http://withdjango.com/ contains "auxiliary material" that is referenced in different sections of the book. Click the "Material for Readers" link and you're taken to links called "Extra resources" and "Source code downloads"; the meaning of the latter link being quite obvious. The page that becomes available by clicking the former link is a "linkfest" of Python and Django resources of every conceivable type, even if they are only barely related to the topic at hand (such as links to the official Firefox, jQuery, and Vim websites). However, back to the book. As previously mentioned, this book has something for everyone, even if you aren't familiar with Python. I say "everyone" in the context some people who have some coding experience and frankly, I wouldn't recommend this book as your first experience with Python if you hope to really learn the language. As author Wesley Chun can attest, entire books have been written on Python, so please don't assume that a single chapter will tell you all you'll need to know. That said, it should teach the experienced programmer what they'll need to know as far as a foundation for working with Django. I do recommend picking up a Python tome of some sort to strengthen that foundation, however. The 56 pages comprising Chapter 1 are just enough to whet the appetite. Chapter 2 is aptly named, "Django for the Impatient: Building a Blog". Most people learning a new technology, myself included, want to get at it right away. Few things are more frustrating than picking up a book expecting to learn to actually do something, and then discovering you have to wade through 200 to 300 pages of concept and theory before you learn to even say "Hello World!". In fact, this chapter almost literally has the reader "hitting the ground running" by putting him or her on a "deadline" to see how fast they can build a simple blog using Django. You've only got 19 pages, so you'd better hurry. Only when you've accomplished this task are you ready (according to the book) to really get started using Django as Chapter 3, "Starting Out" testifies to. You might think it's a step back, because the chapter is mostly concept, but hopefully you'll still be basking in the glow of building that first blog with Django, so moving through a concept chapter won't be as much of a chore. With the foundation now firmly laid, the book proceeds to more in-depth information. The book tries to create a balance between concept and practice and it's a delicate balance indeed. I'm not sure it's entirely successful, but it does its best. If you're looking for a simple "how to" book, this might be a disappointment. The book presents both the "how" and the "why" of Python and Django. Also, although some "beginner" information is presented early in the book, as I said before, don't let this book be your first and only Python learning experience. Without some additional background, you are going to become quickly lost as you advance through the latter pages of this text. At only 408 pages including the appendix sections, you dare not blink while reading this book. All of the relevant information is present and accounted for, but there's no fluff or padding to cushion you. Section Five is complete with a number of "Appendices" (or "Appendixes", take your pick) including "Command Line Basics", the obligatory "Installing and Running Django", and so on. This should help the beginner become reoriented, if they've lost their course somewhere in the book. If you have some programming and web development background, even if Python and Django are new to you, this book should be very helpful, as long as you can tolerate it's laser-like focus and intensity. If you have Python experience, so much the better. If you find yourself slowly getting in over your head, try reading books like Chun's Core Python Programming (2nd Ed) or Mark Lutz's Learning Python before proceeding with the Django book. Whatever you do though, have fun.