Dojo or Prototype or ...?
Listen to this article
I'm about to start adding "funky" Look & Feel stuff to my Rails app and I was wondering what the general consensus (if there even is such a thing) is on JavaScript libraries.
I really don't care so much about the ease or otherwise of making XMLHttpRequest calls; this is the least of my worries—it's trivial to do manually. What I'm more interested in are things such as Drah & Drop, Accordians, Select-as-you-type, and other more general DHTML layout stuff.
Rails itself ships with prototype+scriptaculous which I'm lead to believe are quite good. My mate Andy on the other-hand has played a bit with Dojo and likes that too.
Anyone care to share their own experiences?
Comments
The Rails helpers keep the code clean and they're easy to use, so that's why I prefer the default (protoype/scriptaculous) libraries.
Posted by: Anonymous | December 5, 2005 06:35 AM
Just because its name is Aikido-related doesn't mean you *have* to use it, Simon. ;-)
Prototype+script.aculo.us is really the way to go for Rails apps. Prototype makes JavaScript look more like Ruby (without loosing the essence of JavaScript itself) and script.aculo.us goes hand in hand with the convention over configuration/sensible defaults philosophy of Rails.
Dojo is interesting but quite frankly I think it's slightly over-designed. There's a significant learning-curve associated with it where as you can use script.aculo.us completely out of the box and get results really fast. Just try out the drag-drop stuff or the animations, you should be up and running with it in less than 10 minutes. Also, don't discount the XHR support in Prototype. Sure, it's trivial to fire off an XHR call and handle the result, but Prototype both defines higher levels of interactions and works around several idiosyncracies, bugs and browser incompatabilities. None of these things are trivial and comes through the thousands of projects that have been testing and using the Rails+Prototype+script.aculo.us combo in the field.
Also, if you start doing custom controls for script.aculo.us please do check out the unit testing library and the continuous integration support. If you find you need a new widget I strongly recommend going down this path. Not only is it fun, you'll end up with a better designed and maintainable app.
Posted by: Jon Tirsen | December 5, 2005 08:54 AM
I'll check out the "built-in" stuff then. WRT XHR, I've done quite a lot of stuff with it so whilst I'm more than happy to let a 3rd-party library do that for me, it isn't my biggest concern. What I don't want to do is have to re-invent the wheel for complex GUI-related stuff.
Cheers,
Simon
Posted by: Simon Harris
|
December 5, 2005 09:02 AM