jQuery: It’s a beautiful framework

June 27, 2009 § Leave a comment

I’ve been using jQuery for more than 4 months now, and I love it more and more.

Through out my career I went through Prototype + Scriptaculous, brief Mochikit, MooTools, and now jQuery. But this post is not about jQuery is super awesome and other framework sucks. It’s about why I really like jQuery so much.

jQuery helps me understand Javascript.

Even though I’ve been doing web development for a while, I felt like there were still holes in my brain about javascript. There were a lot of non-obvious little things like:

  • What callback function takes as arguments. (inside AJAX its data; Inside element it could be element or event; etc.)
  • Functions Scope. (I didn’t realize that, because of function is first-class, javascript scoping is similar to Python)
  • What unobtrusive truly means. (If the web app lost functionalities when javascript is turned off, then its obtrusive)
  • What is the best practice for binding/unbinding events.

Because I didn’t have above (basic) questions answered, it’s hard for me to appreciate framework(s) that monkey-patch global objects. That’s the same reason it took a while for me to get used to Rails.

jQuery solves my complains about Javascript

Javascript language is truly verbose, akin to java. IMHO, verbosity really kills scripting language, especially while typing in interactive console.

I can only type so much of these (example):

var domElem = document.getElementsByName(‘someClassName’);

for( var i in domElem ) { console.log(domElem.class) }

In jQuery, it becomes:

$(“.someClassName”).each( function(i) { console.log(i.class) })

Such conciseness is why I like Python and Ruby and jQuery. Shorter code allows me to see what truly important.

jQuery makes being unobtrusive Easy

ready(), click(), bind(), unbind(), and more truly makes being unobtrusive super easy.

I can achieve unobtrusiveness by placing javascript logic at the end of base view/template file (Example):


$(document).ready(function() {

$(“.someDomClass”).click(function(e) {

// Do some stuff





Above technique is common place now, but jQuery makes it concise and easier to debug.

Conclusion: jQuery is awesome and worthwhile investment, for my career and for fun.


Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

What’s this?

You are currently reading jQuery: It’s a beautiful framework at RAPD.


%d bloggers like this: