jQuery Camp 2008

Today’s experience was jQuery Camp 2008. I showed up early enough this morning (approximately the same time as the people responsible for organizing it) to be put to work carrying stuff in. Note to self, being overly prompt is only appreciated when you don’t mind working.

On the way over to the MIT Stata Center I met a guy named Matt who works for University of California San Diego. We were walking the same direction and both made the same turn at the same time and decided that we had to be going to the same place.

As people began to arrive it became apparent that it was going to be a very young crowd, I was probably about the median age of everybody present. I had a peanut butter and jelly blueberry bagel for breakfast, suggested by a guy named Jason—a vegan—who was having the same.

After breakfast was the combined session that served as a welcome, introduction, and a state of jQuery address, delivered by John Resig. Turns out jQuery is kinda the new “it” thing with major new groups getting involved: Microsoft and Nokia. Adoption is absurdly high, and the usage stats show that even Ruby on Rails users are more likely to elect to use jQuery over the pre-installed (!) Prototype, by a significant margin. Looks like jQuery got something right.

The next session I attended was the first of the “Advanced” track, delivered, again, by John Resig. This one was titled “Optimizing the jQuery Core” and (surprise!) covered a lot of the underpinnings of jQuery. He mostly discussed the new core elements and how things have changed in the core throughout the 1.2 release cycle. After that he moved into discussing some exciting things that will be coming in 1.3 that I’m going to have to check more into:

  1. Sizzle. This is a new selector engine coded by John that more closely follows the browser method of selector parsing, starting at the end and traversing up the tree to avoid the need to identify unique nodes at the end of processing the selector.
  2. Append. The current append approach makes iterative calls for each additional element it has to add to the DOM. As a solution to reduce that overhead, this piece of code adds everything to a Document Fragment and simply appends the document fragment (at which point it disappears). This reduces all append operations to a single clone and insertion, massively speeding up the process.
  3. jQuery wants to be the first to do capability testing of browsers instead of actual browser sniffing. This would be done by testing known bugs that have branching code in the core and testing for the scenario that creates the need for that branch. After running the test it can then know which branches need to be taken to support the current browser. This is more closely in line with the progressive enhancement model that jQuery advocates and will allow it to adapt more quickly in the rapidly changing browser market. See also Scott Jehl‘s article on A List Apart.
  4. Deep Profiling. This plugin to jQuery aliases all of the jQuery core functionality to identify where the code is spending most of its time. This seems similar to Firebug’s profiling, but gives the opportunity to view the same sort of breakdown in other browsers.

Yehuda Katz was the next person to speak and he was speaking about a design pattern for jQuery plugins and the process of building a plugin. His example was an autocomplete plugin in less than a hundred lines of (terse) code. He uses a plugin called Effen which allows a user to arbitrarily define functions attached to elements and handles the cleanup of that process as well.

Yehuda’s chat gave way to lunch and a conversation with Steve and his cohorts from the MIT Mobile Experience Lab while waiting in line for sandwiches. They’re actually designing a house right now? Some new project that really has only tangential connection to what they’ve really got going on, but it still sounds like fun and a really cool project.

Lunch was with Matt and two others whose names I’ve forgotten. One of them is working (with? for?) Barack Obama’s tech team on his website and the related backend issues. It was a fun conversation of politics, social networks, and computing in general.

The first session after lunch was given by Paul Bakaus and served as a introduction toward developing with and for the jQuery UI library. It began with a few examples of what could be done and by the end went through a bunch of detailed demonstrations that showed some complicated edge use cases for some of the more popular elements: Draggables, Droppables, and Sortables. A good example that was demonstrated can be found here.

That was followed by a session about Adobe Air given by an Adobe employee. It could have been interesting but turned into more of an intro to Air than a “how to use Air and jQuery together to create an awesome application.” All in all, that was the presentation I was most disappointed with, it held promise, but instead fell flat.

Aza Raskin didn’t show, for reasons unbeknownst to me, so for the third session I instead got an early preview of John Resig’s Canvas and Processing.js presentation that he will be presenting at The AJAX Experience. Processing is a nice hack, but I mostly just appreciated the introduction to the canvas element which I’ve not really used yet. Seems like it could be a neat hack for getting screenshots of what the document looks like back out of the page, opening up all sorts of interesting hacks. I’ll be looking more into that.

The end of this (shorter) presentation was filled in by Marc Grabanski discussing his work with Google Maps integration and its JavaScript API. It is some incredibly pretty (and pretty incredible) work.

The last presentation of the day was given by Joern Zaefferer and can best be summed up as the lifecycle of a plugin. He provided great tips on every aspect from code development to maintenance and release. I plan on copying that model for each and every plugin I create, and I plan on creating a fair number more than the three I’ve already written.

It was during this talk that I realized that my approach I’ve been taking with jQuery plugin development needs … tweaking. jQuery is set up to support multiple instances of itself on the page at any one point in time, and to ensure that I am referencing the correct instance of the window.jQuery variable I need to provide it as an argument to the anonymous function and trap a reference to that particular instance that is current at that time in the closure. I always considered that to be silly, but now I understand a good reason to handle it in this manner.

Now it was dinner time and the food was nothing less than delicious and plentiful. The vegetarian red curry I had so much of was spot on. After fixing my Trac install I went to get in line to serve myself dinner. Also in line was Marc Grabanski and so I introduced myself. Karl Swedberg (one person to the right) said, “Oh, you’re Nathan.” Uh-oh, I’ve been preceded by my words announced in the jQuery-dev list. It’s okay though, that is why I put my name out there so people can hold me to it.

After serving our dinners Marc and I ended up dining together and chatting through the things we were both working on. Eventually Joern came over and he and I got to have a discussion about some of the things I’ve been doing with his validation plugin, the form plugin, and a whole slew of other plugins.

Scott Jehl walked by and I introduced myself to him and got to see some of what he presented while I was in the presentation about Adobe Air. It ended up turning into a show and tell—he has a very cool site map builder that you can see at http://writemaps.com/. Pretty slick if you ask me.

That ended my day at the conference. I walked back to the hotel with Emir and then went on to check in at the Renaissance Boston Waterfront Hotel. After doing that I went to the Cambridge Brewing Company to be social, and talked with Russell Jones and Bill Noon while there.

Bill had a great analogy about JavaScript programming patterns and rules being analogous to rules for adults. Something is private, unless you need it.

The next step was a trip back to the hotel (with Bill) on the T. I wandered around for a bit to see the conference area so I would know where to go.

And then I fortuitously ran into Brian Dillard who so kindly invited me to The AJAX Experience and is the only reason I’m here. More about that tomorrow, along with my comments on what happens throughout the day.