Dojo mojo
Posted: 18 August 2007 at 22:01:46
A couple evenings ago, I had to move some data around for a client. One of their Samba servers was overutilized and was running out of space while another was underutilized and had plenty of space -- more than enough to contain what was on the overutilized server and future growth. The plan was to swap the shares between the servers. The total data I needed to move around was about 300G. I knew, even with a gigabit network, that was going to take a while.
So, while I waited for the rsync process to proceed, I decided to walk myself through an open source JavaScript framework called Dojo.
Now, I should back up here. I've always been sort of anti-JavaScript. I've been witness too many times to what happens when someone designs security for an application using JavaScript and that security goes out the window when you simply turn off JavaScript in your web browser. I've always been a big proponent of "graceful degradation" and my use of JavaScript in web applications has been mostly cosmetic. If I ever developed anything using client-side scripting to add functionality to the application, I made sure there was some server-side logic to back it up in case script interpretation was not available on the client side.
Plus, I would always cite the mobile phone as my example of the user agent that could not process a web application that was JavaScript-heavy.
With all that said, I've started to see the light, so to speak, with regards to JavaScript. With so much of What's Cool on the Web being built using AJAX-type code and with mobile devices like smartphones coming out which support JavaScript, it is starting to make sense to me to get my feet wet and at least get in up to my knees.
A few weeks back, there was a thread posted on a Catalyst mailing list I subscribe to which posed the question of which JavaScript/AJAX framework was preferred by Catalyst developers.
(You can see the archived thread here.)
The answers list members gave included Dojo, jQuery, and the Yahoo! User Interface library.
When Matt Trout -- DBIx::Class and Catalyst guru -- indicated that Dojo was his preference, I made a mental note then and there to check it out.
In summary, it's very cool. I like that it seems to almost agree with the philosophy of graceful degradation. With the Dojo libraries loaded, you can decorate your forms with enhanced widgets simply by adding parameters to the HTML tags. For example, if you have a text field that asks for a date: <input type="text" name="date" />. Dojo lets you turn that into a fancy "select your date from this pop-up calendar" widget simply by adding a few parameters: <input type="text" name="date" dojoType="dijit.form.DateTextbox" />.
Now that's pretty dang cool.
I've been playing with the 0.9(beta) and 0.43 versions of Dojo. The documentation for 0.9 is pretty sparse at this point, but I'm impressed with what it can do.
The one thing I'm a bit disappointed that it can't do is visual effects many other frameworks support like drag and drop, element opacity tricks, etc. Maybe I just haven't run across it yet.
There does seem to be good support for abstracted AJAX functionality including interactive file uploads -- something many of the people I've done work for in the past have asked for.
Fozzout.