The Five JavaScript Libraries

It’s been a while since I wrote any JavaScript. It’s one of those languages that I love, would love to love, and hate. How’s that for a developer’s complex?

It’s not that there’s anything wrong with the language, but until recently, browser support has been a nightmare. I’m sure you, especially front-end developers, have had your share of hair-pulling sessions, when something perfectly legitimate works on one browser, then cracks on another. They would claim they follow standards, yet none did.

These days, browsers ironed out most quirks, they’re all mostly compatible, they all implement the Document Object Model, where each mark up element maps to an object. Only you have to be comfortable with writing recursive functions and dealing with complex trees. Personally, I’m not. I can deal with trees, I just don’t want to. Not when I’m trying to get some work done.

I knew these five libraries should simplify JavaScript work, and ensure my programming sessions don’t cause casualties.

  • Prototype: Being hyped by Rails and all, Prototype was my initial choice for a JavaScript library. It’s well documented, It’s been beaten into shape by many, and overall a solid piece of work. It feels like lax DOM with chained method calls, and it’s obvious how Ruby affected its design philosophy.

  • script.aculo.us: is the effect library built on top of Prototype. Thing like fade in, fade out, dragging and dropping. It also integrates into many frameworks. The only problem is it’s bound to Prototype.

  • YUI: Well, YUI isn’t a JavaScript framework, it’s a complete UI framework, as the name makes it obvious. Ironically, the most notable feature is implemented in CSS rather than JavaScript. When you need tree views, tabs, and sortable tables, this is where you go.

  • Ext: As its homepage says, it started out as an extension to YUI. However its massive 3mb download made me hesitate. Ext has some big names on its list like Adobe, Cisco and IBM, probably because there’s a commercial license offering. It’s quite hefty for everyday’s work, but might add it to your list of potential usages.

  • jQuery: This is the gem I was sold on. jQuery’s philosophy is pragmatic, and its strict about its download size. The minified and gzip’ed version is about 14kb, that’s smaller than you average PNG image. To be honest, I was sold after reading a comparison with Prototype. But then I found out that Prototype isn’t so bad either, it just feels a bit more formal.

The best thing about jQuery is that it can be used with RJS templates, since it also has Prototype’s $() function. The second best thing is Visual jQuery.