Author Topic: Javascript Frameworks  (Read 6910 times)

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Javascript Frameworks
« on: April 11, 2009, 09:34:54 PM »
Those who attended my sessions on Ajax @ Spectrum this year will no doubt recall my rousing endorsement for the Prototype Javascript library.  Since then, I've had a chance to get into a Javascript library called jQuery and... all things being equal I actually like jQuery better.

The syntax of jQuery originally felt a little bit more cryptic at times than Prototype, but that's mostly because I'm still trying to write jQuery the same way that I've been writing Prototype.  Now that I am starting to get onboard with the jQuery way of doing things, I'm finding I can do more just as quick as with Prototype.

Okay, so why do I like jQuery better?

a) jQuery loads faster.  It's noticeably faster than Prototype and significantly faster than Prototype + Scriptaculous.  (That said, I also found a library called Protaculous that is supposedly an optimized Prototype + Scriptaculous, but I likely won't give that a try because it appears to take the Prototype and Scriptaculous code to a second generation, and that concerns me for upgrades.)
b) Speaking of upgrades, jQuery can be easily extended without closing the upgrade path.  That right there is a winning feature if I ever saw one.
c) jQuery has a lot of the UI functionality (that Scriptaculous adds to Prototype) built-in.  Those features that aren't baked in (dragging, dropping, sorted lists, etc.) can be added in with additional sanctioned libraries that build on the jQuery foundation.
d) There are LOADS of scripts available that build on jQuery.  I found a robust autocomplete script in about 10 minutes of searching the web and had a sample implemented with it 10 minutes later.
e) There appears to be a lot more documentation for jQuery. It's not as clear as the Prototype documentation sometimes, but there's a BUNCH of it.  Also check out http://visualjquery.com for a pretty cool way to view documentation.

So if you're just getting started with Prototype (plus or minus Scriptaculous), you might take a detour over to check out jQuery.  I think you'll be glad you did.  And if you're looking for some background on the guy who wrote jQuery, pick up a book entitled "Pro Javascript Techniques" by John Resig.  It's an excellent Javascript book without being a testimonial for jQuery.  In fact, I respect the guy even more because he shows how he's done things without spending the whole book focusing on jQuery specifically.
-Kevin
Accidents "happen"; success, however, is planned and executed.