Why JQuery

Posted: October 2, 2009

I used to be one of those ‘He-Man’ coders. Why do I need to use libraries or frameworks? I’l just code it all by hand and it’ll be leaner and more efficient. Why would you bother to have an extra 15k download? That’s an extra server call! You get the idea.

While there certainly are some libraries or frameworks that are too big or that run slower, that’s more a sign of a poorly made library than anything else. JQuery is no poorly made library.

You may load an extra few killobytes of data once, but you more than make up for that in the code you don’t write.  That 15k contains lots of time and code-saving features that can help turn something that used to take you 5 lines of code into an elegant one-liner, streamlining your code and actually making your JavaScript more efficient.

The first time I saw how much power was wrapped up in simple the simple calls of JQuery, I had gone to Desert Code Camp, basically a free coder’s day camp in Phoenix with presentations on a bunch of different topics.  Looking to fill in time before the Cocoa programming intro, I hopped into the JQuery session.

The first thing the presenter did was probably familiar to many who have used JQuery before.  He wrote a two-inch single line of code to perform list striping, that effect you get when every other line in a list or table is a separate background color.
$("tr:even").css("background-color", "#eeeeee");
He then went on to show off a couple of one-line effects like fading, roll-ups, show/hide, and while he was at it he showed off some of the drop-dead simple css-based selectors to get just the right items.

Needless to say I immediately went home and jumped on the jquery site, picked up a book on JQuery, and started learning the syntax.  Since then I’ve started working it into my own projects and projects at work.  I’ve even started rewriting some old stuff to use JQuery simply because it’s that much better.  Projects at work that would have taken me two weeks or more I’m able to get done in under a week with the time I’m saving from JQuery.

Does this all sound a little hard to believe?  An exaggeration?  Can it end World Hunger, too?  Nope, I guarantee it’s real, and once you start seeing your code collapsing into half its previous size, you’ll wonder why you’d never learned JQuery sooner.

Ready to dive in?  Honestly there’s not a lot to learn to get started.  Simply run over to JQuery’s site and start looking through the documentation, run to Borders and pick up a book, or just stay tuned here in the next couple days and I’ll be giving a quick intro.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Yahoo! Buzz
  • Propeller

One Response to “Why JQuery”

Leave a Reply