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 Palantir.net). 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.
Comments
Start getting rid of Flash for video too
Hoping
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.
HTML5, plus video
I do remember
:)