Javascript Library Wars

Today marks the first day of the Ajax Experience in Boston, MA. I was lucky enough to be able to join up as a volunteer and get in for free (I had come up to Boston for jQuery camp and they were searching out AJE volunteers).

The conference kicked off this morning, and it’s been an interesting experience so far. I’ve been assigned to the Breakout 1 room, which this morning hosted the Prototype presenters, Christophe Porteneuve and Andrew Dupont. They were part of this morning’s “developer day” events, where the leaders of some of the main JavaScript libraries (Prototype, jQuery, and Dojo) had 5 hour sessions (side by side) where they introduced their library and explained how you can get the most out of them and contribute to the community.

The ‘hotness’ of jQuery was more prominent than ever this morning, as our room was very very sparsely filled, while the jQuery room, which was the same size, was packed to the brim.

The imbalance of the turnout was clearly noticed by the Prototype speakers, and this brought about some discussion on the differences between the libraries, and the cases for using each. Now, these guys are obviously biased towards Prototype, but what they mentioned was pretty accurate. Basically, they proposed that jQuery is better for simpler web applications, while Prototype is still more robust for creating custom classes and prototypes, and creating your own sub-library. I completely agree with this, as we use Prototype at Zenbe for our very complex, intricate js needs, and the library makes it completely easy and fun to write complex classes.

The bad thing here (at least for Prototype) is that most web developers are not looking to create super complex JavaScript applications. Most of the time, JavaScript is used to enhance the user experience, adding fancy bells and whistles to make a website faster, smoother, and more interactive.

However, I feel that the complexity issue is not the main reason behind the seemingly mass migration from Prototype to jQuery. A few years ago, jQuery was brand new, contending against the giant which was Prototype. Prototype was the original js library, and once upon a time had almost every front-end developer worth their weight using it. Then jQuery started to gain net buzz, building the strongest web community since Rails. And Prototype was left in the dust.

So, what are the reasons behind this?

The first difference between Prototype’s community and jQuery’s, which the most important and probably the most obvious, is the differences in documentation. jQuery’s documentation is completely brilliant. Their wiki is thorough, accurate, and every function has a series of examples showing how to use it. The documentation really does help ’sell’ the library, providing new users with a wide array of friendly, interactive solutions that are not only slick, but very minimalistic and they help make the developer feel empowered.

On the other hand, Prototype’s API is ‘ok’ at best. The biggest fault with Prototype is the lack of examples. This is a big turn off and frustration for new adopters trying to figure out the language - maybe it’s just me, but seeing sample code is the #1 most important thing I count on during the learning phase of programming. No examples adds ambiguity for novice developers (and sometimes even pro ones) and hinders adoption of a new library. You can’t even compare the two API’s - jQuery’s clearly won the cake.

Another reason people are flocking to jQuery has to do with the user community. I’ve heard that Prototype has a plugin community, but you would never know it by looking on the website. jQuery’s use of keeping the base code as minimalistic as possible, and allowing individual developers to release plugins not only fosters a strong community, but it provides the next selling point of jQuery over Prototype: file size.

By itself, jQuery (compressed to the max) is 15k. Keep in mind, this includes some powerful (yet simple) methods for creating animation. If you were to get the same functionality in Prototype, not only would you need Prototype itself, but you would need to use Scriptaculous as well. Combined and compressed to the max, they rank in at a relatively whopping 50k. Relatively speaking, that’s a massive difference, considering the two libraries do the same things.

One last point I am going to bring up is about the progress of the library development. During the Prototype presentation, the developers admitted that the progress on Prototype has been hindered by busier than normal ‘day jobs’. I can’t hold this against them, nor would I - life happens, I know this as well as anyone. However, it still affects the product. I have been completely frustrated by the lack of development that has been going on with Scriptaculous (moreso than prototype) - the animation library has obvious shortcomings (slideup/down needs a container div? blindup/down forces overflow: visible - which funks up ie), and when Tomas Fuchs Skyped into the conference today to talk about how little the library has been worked on in the last year - well that was a huge let down. jQuery has stomped all over this with rapid development, and it’s progress is clearly paying off, and the recent news of them being adoped by Nokia and Microsoft is only going to help make their development cycle faster and more accurate.

So, with all respect in the world towards Prototype, they need to step it up quite a bit if they want to stay competitive with jQuery in the long run. I’m afraid that if they don’t take some pretty big steps to rebuild the community and actually come out with new releases, they might turn into a thing of the past.

4 Responses to “Javascript Library Wars”


  1. 1 John McFarlane

    Hey great post on the two Javascript Libraries, Prototype and JQuery, I agree totally with your comments regarding

    “most web developers are not looking to create super complex JavaScript applications. Most of the time, JavaScript is used to enhance the user experience, adding fancy bells and whistles to make a website faster, smoother, and more interactive.”

    This is very true and the way JQuery uses your current code makes it such a simple process and thus a simple descion in which library to use.

    I’ve only just started to scratch the surface of JavaScript and already JQuery will be my Library of choice, you can almost pick it straight up and implement it right away.

    Keep up the good posts,

  2. 2 Kevin Marshall

    awesomeness as always…just wondering what people there were saying about Dojo as it relates to these two?

    My personal history is mostly with prototype and scriptaculous (thanks to Rails early support of these)…but I have been playing with JQuery a lot lately (mostly thanks to catalyst support)…and I keep thinking about checking out Dojo just to see what it brings to the table…but I haven’t found the time. Would love to hear what people who are doing these type of comparisons think…ie. you! :-)

  3. 3 Zahnster

    Kevin - I haven’t messed with Dojo much; mostly because once I can’t find a conceivable reason to. Call me a John Resig fangirl, but there has yet to be something about jQuery that I’m not fond of.

    Dojo doesn’t seem to do anything that jQuery can’t, and at the larger file size (and weaker community) I can’t see a reason I’d be using it in the future. I have my hands occupied with ruby microframeworks at the moment (like Camping). :)
    However, one of the libraries I do want to look into more is called Objective-J. It’s made by the guys who created 280 slides (280 North), and their goal in creating the language is to provide application-like power for JavaScript.

    If Objective-J proves itself to be a powerhouse for the complex JavaScript apps, this could mean even worse news for Prototype, as the complexity issue seems to be one of their main selling points.

    Either way, the future of JavaScript looks bright.

  4. 4 Robert Kieffer

    Jade, nice post highlighting the differences jquery and prototype.

    FWIW, the main reason we choose prototype over jQuery here at Zenbe was that jQuery was still pretty wet behind the ears when we started development. Two years ago, it was only just coming on the scene and didn’t have the APIs, community, documentation, or examples, that make it the standout it is today.

    Would we make a different decision if we had it to do over again today? I don’t know. The main requirements I had when we picked Prototype was that the library be relatively compact, that it solve basic low-level cross-browser issues, (event model, DOM access, that sort of thing), and that it provide useful enhancements to the language and core APIs - e.g. a good approach to creating OO code structure, decent AJAX support, native object extensions… that sort of thing. Support for widgets and animations, and other “whizzy” UI stuff just wasn’t that important to me. I *knew* we were going to be writing a lot of JS and I wanted to make sure we had a solid basis for that code. Prototype was the obvious choice back then, and as you point out, it may still be today.

    Objective-J is an interesting project, but I have my doubts about it’s viability. 280 North has gone to great lengths to build what is essentially a Cocoa emulator on top of JavaScript and the DOM. But unless you’ve got a lot of legacy Obj-C code lying around that you want to run in a browser, there’s very little value in that. Even if you do, I’m not sure how much value there is. :-)

Leave a Reply