IncubateTheEgg

Choosing a Javascript library

Incorporating Javascript and Ajax effects into web pages has never been easier. With the growth in DOM scripting a wide variety of open-source javascript libraries have been created. But which one should you go for? JQuery, DOJO, Prototype, Scriptaculous, Moochikit, Yahoo UI , Mootools to name but a few. The answer, as always, is about finding which one offers the best solution for a given problem. Although it would be nice to mix and match this is usually not possible. This is because the individual libraries are associated with separate parent DOM languages. This means that whilst they are all incarnations of javascript, they all handle classes and reserved names in separate, often conflicting ways. Their differing histories and origins has provided them with distinct advantages and drawbacks. I’ll attempt to summarise the key differences.

  • DOJO - linked with the django framework. Rich in features, good browser compatibility. less documentation than others, suited to ad hoc development
  • JQuery - good html php css integration capacity that supports a more traditional dhtml approach. Whilst it provides a lightweight solution it does not have widespread adoption or documentation.
  • Prototype - associated with Ruby on Rails. Has the Scriptaculous add-on which enables convenient implementation of a wide range of effects. No central API docs despite receiving substantial documentation elsewhere
  • Mootools - Architecturally similar to Java. Has a modular lightweight ethos that can negotiate the need for both Prototype and Scriptaculous whilst offering similar features (based partly on Prototype). Good browser support. Being Modular has advantages and disadvantages.
  • Moochikit - linked to the python framework ‘TurboGears’. Compact scripting that makes use of some great python style features. Can be difficult to decide which version is best for a given task.
  • Yahoo UI (or YUI) - ex internal (proprietary) framework for Yahoo gone open source. Great developer resources and documentation. Scripting can be unnecessarily bloated.

Deciding on the right one really depends on the size of your project and what it entails. Do you need a robust library suited to event handling or a more basic addition of effects. Do you want a well established solution or a more progressive one that will grow with your project? I began using JQuery for this site but moved over to prototype/scriptaculous because JQuery lacked the developer support I was looking for (being fairly new to Javascript). Whilst my next project will be using Mootools because I want a more compact solution. The great thing is that once you get your head around javascript, you can usually pick up the library syntaxes without much trouble. It is also plausible that effects can be replicated and translated between the libraries once you are aware of the syntax. The scroll boxes on the right for instance were easily translated from JQuery to prototype/scriptaculous. For more information on javascript libraries check out the following links:

comparison of frameworks

javascript libraries

sitepoint javascript library article

cnet makes a good case for mootools

No comments as yet.

Anonymous - Gravatar

No comments have yet been made to this posting.

Commentors on this Post-

Leave a Comment-

Comment Guidelines:   Feel free to comment on any of the posts, off-topic comments are also welcomed. Email addresses will never be published. Basic html tags can also be included.