7 Reasons To Use Jquery As The Javascript Framework In Your Web 2.0 Apps

Jquery logoJavascript. Is it nightmare? I’m not a seasoned javascript developer myself but I can say that it’s sometimes nightmare especially when dealing with tedious DOM selection and cross browser compatibility workaround.

Good news is the javascript gurus out there always try to find new methods and best practices in dealing with javascript. Libraries and frameworks are developed and published. Best practices are evangelized. More tutorials are written. But still, for non programmers, it’s not that easy to get in touch and familiarized with javascript.

Until jquery comes.. (and you must believe me, I’m not associated with jquery team. I’m an independent writer).

What’s good with jquery? Will it suit your development platform, especially when building Web 2.0 where javascript is extensively deployed? You can read the following reasons and then decide yourself.

Seven reasons to use jquery as the javascript framework:

1. It uses KISS principle

If you haven’t heard about KISS, let me rewrite what it stands for: “Keep It Simple Stupid”. Simplicity. With this principle, non (javascript) programmer can easily get in touch with jquery-ish javascript and start coding his first web 2.0 javascript effect without much wrinkles.

How much simplicity it can offer? Take a look at this example for a simple comparison.

Old javascript way:

<script type="text/javascript">
function linkAlert () {
    alert('You have clicked the link');
}
</script>
<a href="#" onclick="linkAlert(); return false;">The link</a>

New jquery way:

<script type="text/javascript">
$("a").click(function(){
    alert("You have clicked the link");
    return false;
});
</script>
<a href="#">The link</a>

Above example doesn’t help you much? Okay, we’ll have a nicer example.

Old javascript way:

<script type="text/javascript">
function toggleBox () {
    var elem = document.getElementById('box');
    if(elem.style.visibility == "hidden")
        elem.style.visibility = "visible";
    else
        elem.style.visibility = "hidden;
}
</script>
<a href="#" onclick="toggleBox(); return false;">The link</a>
<div id="box" style="visibility:hidden">;The content</div>

New jquery way:

<script type="text/javascript">
$("#box").hide();
$("a").click( function {
    $("#box").toggle()
    return false;
});
</script>
<a href="#">The link<a>
<div id="box">The content</div>

You can say that with less simple-and-clean code, you can do the same with old more complex javascript.

2. It has very good documentation and tutorials

The main problem to get a grip on a new concept or stuff is good direction or manual. Jquery has very good step-by-step documentation. The documentation is maintained and up to date. Tutorials section are provided to guide newcomers and even ordinary people to leverage the power of jquery.

Take a peek at the documentation site and decide if it helps you. Developers can also bring the API reference home by downloading the visual API doc from Visual Jquery.

3. The community is very active, helpful, and warm

Okay, now you’re stuck with your code and the docs don’t help. You will probably think to ask other people, those who ever experienced the same problem or be more advanced in knowledge.

I myself subscribe to the general mailing list. Taking the responses and how people interact in the list, I come into conclusion that the community is thriving well. Responses are mainly contributive and not a simple “have you asked google?”

The experts and core devs are also in the list. So, you can expect professional answer for your problem and share your thought with people who really know their stuff.

4. The core file’s packed size is small

It’s only 20KB and officially supported by the dev team. No bloated size as you previously expect in a robust javascript framework.

5. It deploys almost use-at-will approach

Why I said almost use-at-will? Only with 20KB of packed file you can almost do every javascript functionality from simple hide-show effect to ajax calls. Want more advanced features? Simply pick a plugin from the repository and you’re saved. Again, no bloated size in the core file. You use features you want to use and discard ones you don’t need.

6. It has strong logic and workflow and is easily extensible

If you’re a developer who likes tinkering with stuff, after reading the code, you’ll find how beautiful the code behind jquery is. Jquery has strong philosophy and it’s reflected in the code. It’s well thought and optimized. Also, cross-browser compatibility is worked out there.

After reading the documentation, one will mostly find it easy to extend jquery. And the fact, it is, even if you previously don’t have good grasp and exposure with javascript.

If you see at the page showing sites powered with jquery, it’s an amen that jquery logic and concept is top notch.

7. I like John

Don’t laugh at me or think something kinky. But if you’re a twenty-something man working for Mozilla and you create a mind-blowing javascript framework to be used freely by people and you keep in touch, responding nicely to people who use your work, they will usually like you or might ask you to go for a golf (do you play golf, John? :D).

Stop here, if you’re already in jquery site, reading the doc and about to write your first jquery-ish javascript code or ask your developer to do jquery. Continue if you think this article is unfair by only exposing what’s good.


..

.

Final remark, why should I not use jquery?

Jquery is like another abstraction language on top of javascript. Its unconventional approach to writing javascript can make someone forget how the real javascript is. If you’re a conservative developer who thinks it’s better to write normal javascript instead of simple jquery-ish way, this framework might be not for you.

Article update:

As of August 15th, you can read this very good article from Simon Willison covering introduction and basic usage of Jquery.

0 Responses to “7 Reasons To Use Jquery As The Javascript Framework In Your Web 2.0 Apps”


  • No Comments

Leave a Reply