Featured Post by Mike Rundle »

Do Javascript Libraries Help You Learn About Javascript?

There are so many Javascript libraries nowadays that the decision to use one over another (or to use one at all) is a serious decision. Just like good hardware decisions make for smooth sailing, so too does your decision about a Javascript library. The features you’re looking for, the functionality you need, how much custom code you’ll be writing, how much Ajax your app is using, these are factors to weigh as you make your decision.

Javascript libraries make a developer more productive and ease the cross-browser pains, and nearly all highly-interactive web projects happening at this moment are using a Javascript library, but few people like to get into the downsides of using libraries. Here are some potential negatives to keep in mind:

  • Some weigh-in at a hefty kilobyte size. Caching helps, though.
  • You might use 5% of the features.
  • It might not be in active development and if you encounter a bug it’s on someone else’s shoulders to deal with (unless you’re hardcore enough to fix the issue yourself.)
  • You don’t learn as much about Javascript.

Wait, wait, what did that last item say? Yes, you read it correctly: using Javascript libraries without knowing how they work stunts your overall Javascript learning process. Many libraries let you execute complex commands with just one line, including an extremely simple version of a full Ajax call:

var myAjax = new Ajax.Updater('content_div', 'my_script.php', {method: 'get', parameters: 'id=5'});

And just like that, you may not know how Ajax works or what the heck is going on with onreadystatechange but you just did a one-liner made possible by Prototype and you’re up and running with Ajax. Is this really such a bad thing?

No, it’s not a terrible thing, it’s actually pretty nice. The issue is that unless you can put together some code to do an Ajax call on your own, then you’re really not learning much about how everything works. Using something without truly knowing how it works isn’t such a smart way to go about your profession, but hey, at least you’re using Ajax like your boss told you to.

My advice for newer Javascript coders is to write some things from scratch without using a library. Write a dollar-sign function and an Ajax handler. Extend a base object using prototype, and I don’t mean the library. Learn how to walk on your own, then move to jogging, then use some libraries to move your coding to hyperspeed but only once you know how they work.

Posted August 18, 2008 with 0 Comments


Post A Comment