Tuesday, March 17, 2009

Drupal 6 JavaScript and jQuery is out

I got my copies of Drupal 6 JavaScript and jQuery today.

Honestly, writing this book was a struggle. I think I spent longer debugging JavaScript on a multitude of platforms than I did actually writing the book. That makes the entire experience less enjoyable.

Another frustration with the book was trying to use the appropriate tone. My intent at the outset was to attract a different crowd. Rather than write to computer scientists and software engineers, I wanted to write to new web developers -- perhaps those who haven't done much programming at all. I don't think I met my own expectations in that regard. It is a rare gift to be able to explain something you know well to someone who has little base knowledge.

On the reverse side, I did have a chance to write some of the flashiest book code that I have ever written. Instead of writing generic code, I had the opportunity to start from what Drupal already has and build out. A few of my favorite examples were:
  • The real-time comment notification system (like Growl for a website). I might even have a project coming up that would allow me to use this on a production site.
  • A simple but configurable HTML editor called "better editor" (because it is an extension of an earlier example in the book). I could actually imagine creating a real module version of that.
  • A sorta cool client-side theming engine. It was fun. It has some practical application. Who knows... perhaps someone else will be able to make something useful of it.
So, yes, there were parts of this book that I really enjoyed working on.

Biographically speaking, it was rather strange to write a JavaScript book. I think the first server-side web apps that I wrote (that is, beyond simple CGIs) were written in Netscape's "Server-Side" JavaScript sometime around 1996 or 1997. And my first major consulting position was as a Lawson JavaScript developer. Looking back, Lawson was an unsung pioneer in the field. They were attempting to approximate AJAX with frames (not iframes -- no, this was before iframes were widely adopted). When I jumped ship from JavaScript to Java, I didn't think I'd turn back. But as the technologies have matured, I've found reason to want to script stuff on the client again.

Finally, I think the most interesting thing to come out of the book (and out of a discussion I had with Larry Garfield while writing the book) was QueryPath. Okay, to be completely honest, QueryPath was the result of three things:
  • Wes Munsil's teaching me how to write recursive descent parsers in June. Once I knew how to do it, I really wanted to write one. And who writes CSS parsers for PHP?
  • Learning jQuery. As soon as I started working with it I became enamoured. And the JavaScript book gave me more of a chance to think about its structure.
  • Expressing my frustrations with XML technologies to Crell, who flippantly suggested I write "jQuery for PHP". Really, that was the moment when the entire thing meshed. That happened somewhere around Chapter 4 of this book.
Will I write more books? Probably. I love the process. But maybe I'll take a breather for a few.

Wait... I just came up with a good idea for a book.