Wednesday, August 17, 2011

Why JQuery Rocks?

Dealing with JavaScript is usually a difficult, error-prone and messy task. There are lots of javascript libraries that simplifies the developer's job when using javascript and JQuery is one of them.

There are many javascript libraries but what makes JQuery so special?  This article tries to answer this question by also giving some usage details of some popular javascript libraries .

As stated in the JQuery official web site, jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. You write less and do more!

There are lots of other javaScript libraries out there. Dojo, Prototype, ExtJs, MooTools, YUI ( click for the full list of javaScript libraries ) etc. but JQuery is the most popular of them. In usage statistics, jQuery dominates the market with up to 80% market share. (Check the usage statistics given at the end of this article.)

So, why jQuery is so popular? As a brief summary, JQuery is easy to learn, has good documentation, has an enhusiastic community behind it, has successful cross-browser compatibility, is pluggable and has tons of plugins. Continue to read to learn more.



The Reasons Behind jQuery Popularity

JQuery is easy to learn It has a very low learning curve. Besides having a perfect documentation, the philosopy behind JQuery is simply great! You just select a dom element and perform some task on it. Its very simple to understand. Just check the folllowing example. It finds the "div"s, adds (css) class to them and shows them slowly. Simple to code, simple to understand.

$("div").addClass("ohmy").show("slow");

JQuery is simple Considering the example code above, jQuery objects are chainable. JQuery objects return other jQuery objects and it is possible to perform additional operations in a chain. As you clearly notice, jQuery methods loop through all DOM elements automatically and apply the desired method. There is no need to iterate every object one by one.

JQuery has a clever core library JQuery core library is small and omits fairly common functionalities. Any additional required functionality is added with plugins and there are tons of jQuery plugins out there. So, in jQuery there are several different ways to do one thing. You can choose the one that suits your needs best.

JQuery is pluggable The reason of why there are so much jQuery plugins is that jQuery is designed to be pluggable. The $ method of jQuery just returns a series of DOM objects. A developer can easily extend the Jquery $ method by writing his own selector or by addding a new operation . This advantage makes  jQuery plugins usually much shorter than their counterparts.

JQuery works in most browsers Cross-browser compatibility of jQuery is very successful. Most of the code you write will run exactly the same on all the major browsers.

Big companies supports JQuery and also use it Google, Mozilla, Wikipedia, Netflix, Technorati, Dell, Digg, Drupal and so on. It is also supported by IBM and Microsoft.

People use and love JQuery JQuery has a massive market share. Lots of people not only use it but also write tutorials, share their code, make plugins.

JQuery UI JQuery has a very strong official UI library. It is separate from the core library but sits on top of jQuery perfectly. UI capabilities might not be stronger than some other libraries such as ExtJs but it's getting better.

JQuery Sizzle JQuery core library is 31 KB when minified and g-zipped. It is small but you have a smaller alternative: Sizzle. Sizzle library is 4 KB and it's simplified just to be used for css selection.

To sum up, some JQuery features can be listed as:
  • It's fast.
  • Easy to learn, easy to use
  • Good documentation
  • Community : Tons of tutorials and resources
  • Widespread Adoption : Google, Mozilla, Wordpress, Drupal, IBM, Microsoft use and support it.
  • Cross-browser compatibility
  • Full support to CSS3 selector specification
  • Useful utility functions
  • Tons of plugins, easy to extend
  • JQuery UI library !!!
  • JQuery Sizzle : just 4KB.

Of course, the things I listed here might be applied to some other javascript libraries but jQuery is a better and successful library as a whole.


Usage Statistics of Javascript Libraries

Each statistic belongs to a different research. The figures might differ but each of them shows how JQuery dominates the market.






JQuery History

Released in January 2006 by John Resig.
JQuery name was chosen over JSelect by John Resig because all the domain names had been taken already.
First stable release is in August 2006 and the latest release is 1.6.2 as of August 2011.

Learn More

Wikipedia JQuery Article
Wikipedia JavaScript Frameworks Comparison
List of Javascript Libraries


This article is also introduced in DZone.



No comments:

Post a Comment