On JavaScripting

Now a little something for our techie readers… we do have a few right?

One aspect of Ruby on Rails that I don’t like (surprising, I know) is the bundled Prototype JavaScript library.  When Prototype came out, I loved it.  The $() selector introduced a novel way of writing JS code.  Then other libraries came out like Dojo which introduced other idioms that were cool.  But then after a while John Resig introduced jQuery.  jQuery is by far the best JavaScript library I’ve come across since I’ve been writing JavaScript (late 90’s).  jQuery takes the $() selector that Prototype introduced and centers the entire library around it.  Everything is done through the selector.  I’m not going to explain how it all works, you can do that yourself by going to the jQuery site and browsing through the docs.

John Resig the creator (who works on the guts of JavaScript at Mozilla) had an interesting post on jQuery’s conception and community.  He had this to say about jQuery as a domain specific language:

“I love being able to see users who truly understand just how different the end result can be, especially in comparison to normal DOM scripting. There’s a specific moment where it just clicks for them, where they realize that, this tool that they had been using, was in fact much much more than that all along. And suddenly their understanding of how to write dynamic web applications completely shifts. It’s an incredible thing, and absolutely my favorite part of the jQuery project.”

The “shift” John is referring to is something that happened to me.  It’s also happened for a number of friends I’ve seen who’ve used jQuery.  jQuery is like Rails for JavaScript.  It’s the most productive JS library I’ve used.  Once you know the basics, you can just get things done.  In most cases, you can write a few lines of jQuery code to substitute dozens of lines of traditional JavaScript.

If you haven’t used jQuery before, give it a try.  I’m a big fan.

AboutRich Manalang

a.k.a.: manalang

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.