Review: 'Drupal 6 JavaScript and jQuery'

Let's start with a confession: I don't like JavaScript. I don't like object notation and I don't like programming languages where whitespace (line enders) is significant. I cut my teeth on C, and I am suspicious of any deviation from its spartan truth. I also don't trust power windows and think the Volvo 240 was the pinnacle of automotive engineering, just to put it all in context.

And I already have a book on JavaScript: "Programming JavaScript for Netscape 2.0." It's on the dusty, rarely visited end of my bookshelf, right next to "Internet Starter Kit" with a floppy disk containing TurboGopher 1.07.

So I'm not a great candidate to review the book on JavaScript that Packt shipped me a couple of months ago.

Nevertheless, I'm impressed with Matt Butcher's "Drupal 6 JavaScript and jQuery."

Like it or not, the poorly named JavaScript (it has nothing to do with Java) is the most dependable client-side programming tool we have. With Apple's recent attack on Flash, which is banned from the iPad, it's going to become even more important. If you want pages to do anything more than sit there and look at you, JavaScript is your tool, period. So deal with it.

Butcher's book is really about three things: The JavaScript language as it's currently implemented, the jQuery library that gives JavaScript a set of simple but powerful incantations that can cast magic spells on HTML, and how both of them fit into Drupal's modular, themeable framework.

In the preface, Butcher declares, "you will learn everything you need in this book." That's overly ambitious but only slightly so; if you're generally familiar with HTML and pretty much any programming language, you'll be able to follow along without difficulty. Butcher is literate (he's working on a Ph.D. in philosophy at Loyola), a veteran technical writer (five books for Packt Publishing) and a bona fide Drupal developer (for Chicago-based He knows his stuff and explains it well.

If you're a designer working only in Photoshop and you've never written a line of code, you're going to have a tough row to hoe, but even then you can probably keep up if you put in the energy. Butcher assumes little and explains everything, but does so efficiently. If you need to be told three times, you're going to have to read three times.

As the book moves along, it progresses from being heavy on explanation with brief examples to being heavy on exercises with brief explanations. By Chapter 3 you're extracting data from the DOM, manipulating CSS, and creating content carousels. By Chapter 4 you're writing a text editor, a project you'll keep enhancing later in the course. By Chapter 7 you're fetching structured data across the network (AJAX, JASON, AHAH, etc.) By Chapter 8 you're writing Drupal modules and qualifying for your wizard's hat and gown.

The jQuery library is an open-source project with many benefits, including hiding some of the occasionally ugly differences between the ways two browsers behave. It's been adopted as an official part of Drupal, but also has the backing of Nokia and Microsoft and shows up in many other Web applications.

When it's properly used, it can greatly improve Web usability. I've been looking at Drupal 7, which is not yet released, and it's completely transformed the experience of managing content in a Drupal environment through smart application of jQuery-driven effects. When you want to edit something in D7, you just point at it, click the control that magically materializes, and watch as an editable version appears in a layer, courtesy of jQuery, AJAX and standards-compliant HTML.

I've been quite frustrated this year with JavaScript as we've struggled to improve page-rendering performance on our newspaper websites. Third-party JavaScript from various advertising engines and video services has been killing us. If everyone used jQuery, we'd all be better off. The core library is tight and highly compressed, and it makes possible an awesome economy of expression. Because it's so well supported by third-party extensions and plugins, we've been able to pretty much banish Flash from our site content for everything except video delivery.

If you're a developer and you aren't familiar with these tools, you need to be. And I'd recommend Butcher's book as one of the best-crafted technical training manuals I've come across. Dig in.


Hi Steve, You can get a little farther along the path of Flashlessness with 100 per cent compliant HTML5 and Flash fallback for stupid browsers that don't get the < video > tag: And I share your wish that we could standardize on JS libraries. Either called from the same central location (Google Code?) or built into browsers. I've been to Wordpress sites calling three different libraries (jQuery, Scriptaculous, YUI). I've been to networks of sites all using jQuery and all run by the same company, yet each requiring I download a domain-specific copy of jQuery. It sucks. And ads. Yikes. The IAB should get involved and call for standardization of JS libraries and demand the use of HTML5 async. I mean they hint at it here, but not really:

We use Brightcove for most of our sites and Drupal's emfield module for embedding. I'm hopeful that Brightcove will support native video soon, and it should be trivial for us to switch, but there's a yet another format war that has to be fought first. Jeremy Allaire's post on Techcrunch isn't encouraging about a timeframe.

I know a lot of people are eager to bash Flash video these days, but we should remember that the wide cross-platform support that Adobe provided for Flash enabled Web video to get big in the first place. I remember what it was like in the pre-Flash days of format wars and RealVideo hijacking all my system settings every week. It wasn't pretty. For several years now I've had an ARM-powered Internet tablet that runs Linux, and even it shows Flash video.

I think you're right, that these tools are going to be more and more important (and I'll check out the book). Video's going to add a whole new layer of complexity, however. I wrote an article Friday trying to round up info on the format wars you mention that arise because of the copyrights on video codecs, which may be useful to the same folks reading this article: Flash may be the simplest solution until this all gets ironed out.

I do remember the days before Flash video. It sucked ass. Flash made YouTube possible, and YouTube increased Flash's ubiquity, like insects and flowering plants. Flash is awesome. I like Flash. I don't do Flash, for various reasons (mainly I'm a cheap bastard who won't load warez), but I am not blind to its usefulness. But I like open standards even more. I like it when I can muck with things in a text editor and not have to use an IDE. I think Adobe will adapt quite well building IDEs to work with and . As for that other format war, with YouTube and Vimeo both supporting h264 I think it's pretty obvious how that's going to turn out.

I know what you mean, Javascript is one of the worst part of webdeveloping. When I have a project to write in JS I only hear WTF from my boss like on this pic