Print
PDF
10
April
2009

Javascript Libraries - Which one to Choose?

I use Prototype at work and am using it from last 3 years, though I have not done very extensive JavaScript programming-designing fancy UIs and all, I use it for all of my basic JavaScript requirements and it works like a charm.But off late, every since I started developing this website, I wanted to explore on something new using which we could develop complex client side UIs more seamlessly.

Though PraisedLight is a Joomla based website, I have a Music section in this website where in I wanted to try some fancy things. I came across jQuery and found it quite simple to use.Especially for somebody like me who worked majorly at Server side (Java) for a long time.Below are some of the important advantages of jQuery that I have found in my use so far.

  •     Its light weight when compared to other JavaScript frameworks and is extremely easy to learn.
  •     It has a wide range of plugins available for various specific needs
  •     It is easier for a designer to learn JavaScript as it uses familiar CSS syntax. jQuery is Javascript for Designers
  •     The whole concepts of querying and chainability fit very well with DOM manipulation, which seems to be the brunt of what people use JS libraries for.
  •     It's the most well though out language you'll find -- it's almost intuitive.
  •     It has an active community and its website has very good documentation.
  •     Separate library if your are interested in developing something fancy (jQueryUI). This keeps the core library simple and lightweight.


Some simple samples of jQuery's usability and simplicity are

Want an element's width?
$('#something').width();

Want to grab an element, hide it, change it's background color and fade it back in?
$('#something').hide().css('background', 'red').fadeIn();

Want load the response got from a php file to a div, just do this.
$(document).ready(function()
{
      $("#divid").load("sample.php");
});


To be very frank, I never made any serious comparison of all Javascript libraries before narrowing down on jQuery for usage here in Praisedlight.The reason for this was that I was doing this only for fun and I wanted to try out something that is latest, that is cool and that is enjoyable. And once I started on jQuery, there was not turning back. But as I write this post, I became curious and did some research (of course on google :)). Just to give a heads up, these are the popular JS frameworks available today.

Yahoo UI Library, DOJOExt JS,  qooxdoo, GWT

I found the following comparisons quite interesting

http://www.kauriproject.org/wiki/g1/g4/g2/69-kauri.html
http://www.zenperfect.com/2007/08/11/javascript-frameworks-compared/
http://wiki.freaks-unidos.net/javascript-libraries

Other than these, I read few more comparisons and most of them rate Prototype and jQuery as the top JavaScript libraries in terms of speed, simplicity, handling complex scenarios, and learning curve. Though some say that jQuery might face challenges in handling really complex scenarios, I not very sure of what are those so called complex scenarios that jQuery can't handle.jQuery has definitely an advantage over Prototype when it comes to simplicity and the lines of code you need to write to implement a functionality.

The other library that I was seriously considering was GWT because of my familiarity with Java. I thought that it was really very cool to write code and then GWT engine convert it to efficient Javascript.But for some reason I did not go for it, probably because of the learning curve in terms of understanding the Java API of GWT.

Today I am very happy for taking jQuery path and I have found quite a few resources to learn this.Some of them are

http://jquery.com -
Offical website
http://jqueryui.com - Official website for jQuery UI
http://visualjquery.com - Very nice site that has visual representation of all jQuery functionalities
http://www.learningjquery.com - Nice guide to learn advanced jQuery
http://blog.themeforest.net/ - Has plenty of video tutorials to start on jQuery.This is where I started!

Though it would not have made much difference in this website, it is a cery critical decission to take in development of a large webproject as to which JS library you choose. I hope this article would have helped you in someway in taking those decissions. I also hope I truly use the jQuery features to its full capacity one day and do justice to what it offers!

Author: pradeep