Javascript: The Quickening
There have been philanthropists in javascript development since the language was concieved by Brendan Eich. A few that I can point to as having provided tools and inspiration along my path in web development: Mike Foster and his excellent x library (and it predecessor) which just worked and added some bling to projects of a few years ago; Brent Ashley and the jsrs library code and examples which opened my eyes to a new form of optimisation I could use in the web applications I built; PPK for the never-ending resource that is quirksmode… I am sure you all could name others that facilitated your own web application careers – feel free to add to this article in the comments.
In more recent “web 2.0″ times it was the success of Sam Stephenson’s Prototype, defined by its syntactic sugar which reminded the web development community at large of the dual functional and OOP natures of Javascript (invigorating in the face of the millions of custom procedural functions that previously ran the web). This has driven the current increase in client-side scripting interest. Of course Prototype was also helped in part to the libraries which built on it such as Thomas Fuchs’ Scriptaculous and Open Rico and also those influenced by such as MooTools. I would argue that all this activity (and other developments) was itself fueled by the natural return to ascendancy of web development that was always imminent after the tech crash’s over-correction.
With exploration of Prototype (and Javascript in general) we also learned. We learned that messing with the Object.prototype is verboten and that there were better ways to include functionality than inlining everything. Ben Nolan’s Behaviour library demonstrated this best (well then, anyways, these days I now just include separate files which use the various selector functions in combination with the cross-browser Event Handler implementations found in each major library).
Mid-way through last year we were evaluating libraries, namely Prototype, Jquery, Dojo and YUI. YUI won out for a number of reasons. Jquery looked great but it wasn’t at version 1 yet and seemed to be changing on a weekly basis (for the better, but that was too much flux for a project destined for our end users). Prototype I had used in some of my demos but the documentation was sketchy and every example relied on inline script tags scattered through-out our templates. I trialled out Behaviour which was quite handy but some examples were not easily recreated when combined with Behaviour. We were also concerned that Prototype would not play well with others. We wanted to leave the door open to continue using other third-party libraries in the future.
Dojo looked awesome but again was low on useful documentation (They have much improved – in fact all libraries have, in this regard). The Dojo events package looked very cool with its AOP-style approach but I had reservations that it might add too much ramp-up time to our tight schedule.
YUI had a combination of API and example-driven documentation as well as coverage on all the key features we needed. Its namespace implementation was simple, allowing us to get in and comprehend their code quickly. Once undertaking the project we did find that the documentation could still have been much better, but such are the joys of open-source libraries and their documentation, right (php is an exception – the comments on the API pages was a stroke of genius)?
The last twelve months have seen Dean Edwards and John Resig and others team together to provide a cross-browser solution to detecting when the DOM content had completely loaded (at a time before assets such as images have completed downloading).
This month has seen Jack Slocum weigh in with faster DOM search functions, setting a new benchmark in the area that John Resig had previously thrown down the gauntlet. This sort of collective innovation is for the good of the community and is providing an accelerated environment of innovation. I don’t fully subscribe to information singularity as while I do think acceleration can be hyperbolic it will more likely form an ogilve, flattening at some point rather than continuing to approach infinite (there are, afterall, limits to our ability to process information and effeciently distribute it amongst the hive-mind that is the community that forms around any topic of learning).
Philosophic analysis of the phenomena aside I do think it is valuable to recognise the progress that has been made and the factors contributing it and encouraging everyone to continue providing and contributing to the environment that has allowed us all to flourish.

January 24th, 2007 at 6:55 am
[...] Coding Horror covers some general criticism of Javascript libraries reminiscent of a few criticsisms I eluded to in previous posts such as “Javascript: The Quickening” and “Yahoo’s YUI Drag and Drop Module”. I think it could be stretched to other languages as well however as javascript has been a focus of mine recently (and many others) I thought I would explore some frustrations with working with the YUI library (as well as some other libraries) I have had recently. [...]
January 25th, 2007 at 1:30 pm
I agree that the “competition” between frameworks has accelerated innovation and made the landscape better for all. I put the word in quotation marks because I think the major frameworks compete with each other in only the loosest of senses — each one chooses a different philosophy, thereby self-selecting their user bases.
As a member of Prototype Core, I feel obligated to mention our new web site, complete with exhaustive documentation. And though I understand the viewpoint of those who prefer not to augment built-in prototypes, I should point out that I have not heard of one single instance where Prototype conflicts with another JavaScript framework.
January 27th, 2007 at 5:42 am
Its been healthy and (generally) friendly. I’d be interested in seeing some attempts to define the philosophies behind each library. Jquery is excellent at keeping a smaller API footprint and this has clearly been one of their goals – even retiring methods recently in favour of more generic functions with more broad parameters in favour of more specialized method names with fewer parameters. It does however force most actions to start with an element which does make me wonder what I do when I want to use its language features outside the scope of an element.
Prototype does conflict with javascript code which is reliant on ‘for…in’ for example and this recently required us to rollback a deployment and factor prototype out and replace it with YUI. I think that by version 2.0 most of these issues will be behind Prototype (based on recent comments by Sam Stephenson).
January 28th, 2007 at 10:25 pm
I agree with your description of jQuery. Prototype and MochiKit are deliberate efforts to make JS feel more like Ruby and Python (respectively). I’m sure Dojo and YUI have some sort of guiding principles, but I’m not familiar enough with either one to know what those principles are.
It is true that Prototype conflicts with associative arrays, but using
for..inon an array is risky in any situation.My statement was that Prototype does not conflict with other frameworks — if you have code that uses
for..inon arrays, you’d have to refactor it. But that’s the only way in which Prototype would collide with existing code.I’m not sure which comments of Sam’s you’re referring to, but I don’t think we’re planning to remove the
Array.prototypeaugmentations in version 2.0 or thereafter.January 28th, 2007 at 10:45 pm
I agree – for..in is risky and we don’t use it in our own code (although the recent deployment did highlight a very old bit of code using it which was then refactored). I think the library which had issues was ‘x’ from cross-browser.com but I could be wrong. I will check with our QA team and see if I can confirm this for you.
Sam’s comment was actually more about the OO side of things moving to something more akin to Dean Edward’s ‘Base’ and I guess I had assumed this might also address the Array augmentations but that was probably a misguided assumption on my part
I am keen to have a play with the latest Prototype release supported by the new documentation site. You’ve inspired me to have another tinker