Before I dive into the various libraries – one of the primary concerns you SHOULD have is what license a particular library uses. If you don’t know much about licensing or feel that it’s beneath you, maybe you should listen to our podcast on the differences between various licenses and how they apply to the open source community.
JQuery (MIT License)
If you’ve been programming on the web for any period of time, then you’ve heard of JQuery. This is pretty much the de facto JS library on the web nowadays, and for good reason. JQuery brings a ton of functionality out of the box, including fantastic DOM querying functionality, cross browser DOM manipulation and AJAX functionality. If you’re writing a custom website and this website is not necessarily data-intensive, JQuery is probably as far as you need to go. What do I mean data-intensive? I’m basically talking about querying from a database and outputting to a page on your site. If your site focuses primarily on loading and saving information from a database, there are other libraries that may be more suited to your needs, as we’ll find out shortly.
On top of all the built in functionality of JQuery, there is also no shortage of 3rd party plugins that have been written to extend JQuery even further. Anything from UI plugins for tabbed views, grids, calendars, etc. Seriously, if you want on the biggest platform that exists, JQuery is it, however, just because it’s the biggest, it doesn’t mean it’s the best – it really depends on your situation.
ExtJS (GNU GPLv3 or Commercial License) and Dojo Toolkit (MIT or AFL License)
I’m grouping these two libraries together because they will serve the same purpose for most people. If you’re working on an application (as opposed to a website) that focuses on getting and displaying data and creating interfaces that are very widget oriented, then you absolutely must look into either ExtJS or Dojo. The one major thing to keep in mind when working with either of these libraries is that you are fairly limited in what you want your application to look like. Both have a very “Windows” type look to them that pretty much dictates the overall look of your application. It is true that you can customize the color schemes and slightly modify the overall look, but basically you’re going to have an application that looks the same as all other ExtJS or Dojo applications.
The key thing here is though that both these libraries focus on providing useful, reusable widgets. ExtJS is probably best known for their incredible window and grid components, and just superb documentation. Dojo Toolkit also has a great set of widgets but to me, their documentation is not on par with ExtJS. It’s not that the documentation that exists for Dojo isn’t good, it’s more that it’s just not as organized and well thought out as ExtJS’s. Also, I feel that ExtJS’s widgets, in some cases, are a little more mature than those available in Dojo. For instance, the ExtJS grid is just fantastic to work with while to get near that same amount of functionality in Dojo you’ll be looking to use either the DGrid (3rd party component) or GridX (also another 3rd party component), and still I feel that ExtJS’s still has an edge on both.
So then why would you ever pick Dojo over ExtJS? Simply put, licensing. While licensing is not in the scope of this article, the primary reason one would choose Dojo over ExtJS is their extremely open licensing – you can choose to use Dojo under the MIT or the AFL (academic free license)…so what in the world does that mean?! Essentially you’re free to use Dojo Toolkit however you’d like to and you don’t have to make your own source code available to anyone else. On the ExtJS front, you’ll either be utilizing the GNU GPLv3 license, which essentially is a copy-left license…again, what in the world is copy left?! Essentially if you opt to use the “free” version of ExtJS (GPLv3), then you are supposed to provide the source code for your application when you deploy it. The interesting part is there’s a lot of grey area as to what you actually have to provide in terms of your own source code so it’s worth noting that if you don’t want to worry about potentially giving away your application code, then you’ll need to opt to buy the commercial license, which at the time of this writing appears to be $329 per developer without any type of support.
One last thing to clarify – I’ve been working with ExtJS for years, and I’ve got several months worth of Dojo under my belt, and I must say, while I don’t feel that Dojo is as polished in terms of some of the widgets, there are definitely some features of the Dojo Toolkit that I feel are much easier to implement than are the ExtJS counterpart – things like creating templated custom widgets.
So again, if you’re looking to create an application – typically something more geared to internal departments in an administrative type of site, then both ExtJS and Dojo are fantastic choices.
Knockout (MIT license)
Hopefully this has given you an idea of what these popular libraries have to offer. The only thing I’d like to offer in addition is to be aware of the licensing that these or any libraries use. If you’re creating some super-duper proprietary application and you choose a license that indicates you’re going to have to open source your own code, you could lose out huge in the end. Just because something is open source doesn’t mean it’s “free”. It’s much better to investigate these things up front than find out the hard way. In the end, look at what you’re trying to create and determine what’s going to be the best for you. If you want to focus on data and don’t want to have to think about designing a look and feel to an interface, then ExtJS or Dojo. If you’re looking to just enhance an existing website and you want to be able to quickly access and manipulate existing things on the page, the JQuery is a fantastic route to take, and one that is adopted by a ton of sites on the Internet. If you want to develop a highly customized look and feel but you need some data interactions and don’t want to get in the mud with DOM manipulation, give Knockout JS a try.
While it’s frustrating that these libraries are popping up all over the place, it sure beats the pants off trying to write all these things on your own. I remember the days of having to code your own DOM inserts such as adding new rows and having to do it differently for varying browsers. Now, you have more options than you probably want to dig through! 🙂