How to choose an AJAX/Javascript Library

January 31st, 2010

When considering which JavaScript tool to choose as your primary go-to library, a developer has a lot of choices. And, this is probably the hardest part about making a choice. So, any investigation into this matter is made a little easier, if you first consider the libraries less as one large mass you have to make sense of, and instead realize that like anything else in the technology world, each one has specific goals and philosophies behind it, and what you need to do is figure out which one most closely matches your needs. Because, there is no one “best” tool for any job (as we all know), just the right tool for the particular job.

So, I’ll start right off the bat by making your job easier. A review of the JavaScript tools landscape will quickly find that while there are similarities across them, the breaks in functionality are telling. I’ve found that the frameworks can generally be divided into three major categories (in order of increasing complexity, if not sophistication):

  • Type 1 – JS Language Enhancement Libraries
  • Type 2 – AJAX Frameworks
  • Type 3 –RIA Development Platforms

Note that several tool kits may span more than one type, and that’s OK. I’m not saying that any library can be classified by their type, just that this classification can serve as a guide in deciding which feature-set is best suited to your needs. Think of it as saying off-road vs. sports vs. luxury sedan rather than coke vs. pepsi.

Level 1 – JavaScript Enhancement Libraries
These libraries are the least complex of the available tools, they’re classified as libraries, rather than frameworks, for they only provide tools for enhancing the JavaScript language, bridging the cavernous divide of x-browser development, easing DOM and CSS manipulation, and providing a basis for other development as well as proper frameworks. Think of them as creating a “Super” Javascript, with better capabilites. Moreover, you will find that Frameworks often espouse their compatibility with at least one of these libraries.

The greatest strength this category of tool has is in the nimbleness they provide. They tend to have small footprints, flat learning curves, and not a lot of fuss about them.

The tools that are the major players in this first category are:

These libraries each have a different philosophy, and understanding what each one is is essential to picking the right one.

Primary Purpose: Language enhancements and libraries to simplify JS in general and light AJAX widgets
Strengths: Wide adoption, light weight, flat(ish) learning curve
Weaknesses: Like a budget car, it will be hard to find all the features you need in one package. Ad Hoc/Add-on widget toolkits.
Who they’re for: Novice users trying to get up and running with AJAX quickly, Advanced users who want to roll their own solution on a standard library.

 

AJAX Level 2 – AJAX Frameworks
While Enhancement Libraries make the JavaScript language easier to use and reduce the amount of work and maintenance associated with developing your site, they tend to run out of steam when you are building an application that is reliant on AJAX for its major functionality. This is where the simplicity of enhancement libraries becomes a liability, and the complexity of frameworks becomes an asset. Rather than rolling your own solutions for complex problems such as managing namespaces, class loading, manipulating XML, testing and debugging, a full Framework will have some or all of these solutions built in. By throwing your hat in with one of these tools, you’re saving yourself the headache that comes along with building and maintaining these parts of your application. As with the enhancement libraries, understanding the individual strength and philosophy of each tool is paramount.

The major tools within this category are:

Primary Purpose: Provide all-in-one widget and language utility AJAX system
Strengths: The flexibility of a middle child. Strong support for advanced AJAX methods, such as call management, sophisticated XML and JSON utilities and strongly coupled widget toolkits.
Weaknesses: Higher learning curve, feel more cumbersome than the Level 1 toolkits, lack the power of the Level 3 environments.
Who they’re for Developers of advanced AJAX applications that want the utility of an enhancement library, with the power of the programming environment, but aren’t willing to commit to a new environment and aren’t trying to build a thin client application.


AJAX Level 3 – Rick Internet Application Development Platforms

While Level 1 makes your life easier, and Level 2 saves you from having to roll your own advanced features, there’s one level beyond this that is the true AJAX application. At this level of complexity, the AJAX framework provides a full application development environment, like Apple’s Cocoa, or Microsoft’s Visual Studio, which allows you to build a single-page web application that looks nothing like a web page and everything like a traditional fat client application. From the MVC point of view, this is the endgame, where you have both controller and view on the front end, completely decoupled from and agnostic to the model layer. While it is not necessary to take on a Level 3 tool in order to build something this complex, the support these environments lend to the development process allows the developer to forget about the details of user interface plumbing, and concentrate on implementation of the particular application.

The tools within this category are:

 

Primary Purpose: “Single Page” / Thin Client AJAX application development
Strengths: Powerful Development tools: Full IDEs, Testing and Debugging, Web Services/RPC support, etc.
Weaknesses: High learning curve, in the case of capuccino, learning a new language
Who they’re for: Data-intensive applications with established back ends / services that need an even more powerful front end, especially “dark matter” applications. Developers who want to write desktop applications that access the web, but think JavaScript and HTML are children’s toys.

Conclusion

There is no ‘best’ framework, only the right framework for what you’re trying to do. If you’re just trying to add some snazzy widgets to your website, or find a standardized way to deal with the vaguaries of x-browser DHTML, the Level-1 Enhancement Libraries are for you. If you’re trying to get your hands on a bunch of high end widgets, quickly, and are willing to pay the price in both money and time spent on the very steep learning curve, then Ext is probably the best choice. If you have folks that are comfortable with the Level 1 JS tools (jquery, mootools), are trying to write an application that is more than just UI widgets, and want those widgets too, then Dojo is the best choice. YUI3 is not ready for prime time as of this writing, but if you’re willing to write all your object code and widgets on a very strong DOM-centric model for events and selectors, then YUI is for you. In 6-12 months, I’m guessing that YUI will be a strong contender for an all-around winner, and definitely better than Ext, but by then, both it and Dojo will be a year ahead from where they are now. And if what you want is something that looks and is developed like a traditional desktop application, and you’re willing to invest the time and make the commitment, then you should give the Level-3 toolkits a hard look, because chances are, you’ll end up there down the road anyway.


Leave a Reply