7 reasons why you really should learn jQuery

Below are my 7 reasons why you should learn a javascript framework, and that the best one to learn about is jQuery.
1. jQuery seperates behavior from markup
In HTML markup it is still quite common to see things like this:

Even though the validate() function can be placed in an external file, in effect we are still mixing markup with logic and events here. jQuery allows you to completely seperate the two. With jQuery, the markup would look like this:

Next, the seperate JS file will contain the following event subscription code:
$("myform").submit(function() {
...your code here
)}

This allows for very clean markup with a lot of flexibility. jQuery takes javascript out of your markup, much like CSS took the style out of markup years ago.
2. Write less, do more
Write less, do more - it is the jQuery slogan, and it is an accurate one. Using jQuery's advanced selectors, you can do amazing things in just a few lines of code. You do not need to worry about browser differences (much), there is full Ajax-support and many other abstractions that make you more productive. jQuery takes javascript to a higher level. Here's a very simple example:
$("p.neat").addClass("ohmy").show("slow");
That little snippet loops through all
elements with the class "neat" and then adds the class "ohmy" to it, whilst slowly showing the paragraph in an animated effect. No browser checks, no loop code, no complex animation functions, just one line of code!
3. Performance
Out of the big Javascript frameworks, jQuery understands performance best. The minimized and gzipped version is only 18K in size, despite tons of new features in various releases, this number has hardly changed. With each release, major performance improvements have been made. This article is telling of the raw speed of jQuery and the focus that their developers have on it. Combine this with the new generation of browsers (Firefox 3, Google Chrome) that have fast javascript engines on board, and you have a whole new wealth of possibilities in creating rich web applications.
4. It is a "standard"
JQuery is not an official standard, let that be clear. However, the industry support for jQuery is overwhelming. Google uses it, and even hosts it for you. Dell, Digg, Wordpress, Mozilla and many others use it too. Microsoft is even shipping jQuery with Visual Studio. With so much weight behind this framework, you can consider it a safe choice for the future, and a safe bet to invest time in.  
5. Plugins!
There are thousands of plugins developed on top of jQuery. You can use it for form validation, galleries, field hints, animation, progress bars, you name it, it is available. The jQuery community is an eco-system, not just a library. This further supports reason #4, it is a safe choice. By the way, did you know that jQuery actively works together with their "competitors", such as Prototype. It looks like they're here to improve the overall state of javascript, not just for their own benefit.
6. It costs you little time
Of course it will cost you time to truly learn jQuery, especially if you will be writing lots of code or even your own plugins. However, you can do this in bits and pieces, there are tons of examples out there and it is really easy to get started. My advise is to first have a look in the plugin pool before you code something yourself. Next, have a look at the actual plugin code to see how it works. In short, learning jQuery is no huge investment, you can be productive right away and increase your skill in small increments.
7. Fun
I found working with JQuery to be a lot of fun. It is fresh, short and you quickly get results. It solves many nagging javascript problems and annoyances. I used to hate javascript coding but (somewhat) enjoy it now. With the basics fixed, one can now really think about developing next-generation web applications, without being slowed down by an inferior language or tool. I believe in the "Write less, do more" slogan.It is true.

Courtesy :ferdychristan

No comments:

Post a Comment

Please Provide your feedback here