Monday, February 13, 2006

Script.not-so.aculo.us

Because of the context in which it runs, JavaScript is a highly unusual language. Much JavaScript code is open source, but even that which isn't is "apparent source." Everyone's scripting skills are on display. It's a film festival crying out for critics.

As a coder, that's scary to me. I know I should welcome constructive feedback on my code, but it's oh-so-painful, especially when done in public. So, you know, be nice.

I've been using the RoR framework for building my web application, and I like it. Ruby is beautiful. The Rails framework feels simple, even though there's a lot going on under the hood. It makes sense to me. YMMV. Anyway...

Built right into RoR is a JavaScript library called Script.aculo.us, which provides DHTML goodies, such as visual effects (fading, resizing, repositioning, etc.) as well as drag-n-drop tools. Its author has selflessly given his code away for all to use. It's like the Summer of Love all over again.

With all due respect for Script.aculo.us' creator, I regret to report that I find it unusable.

If a library is a black box, providing all the right buttons and levers to fiddle with, and they all work as advertised, then great -- we don't have to care about the internals. For me, script.aculo.us fails the "black box" test. (How? I'll have to document that soon.)

Secondarily, if a library fails the black box test, but its internals are sensibly structured (clean OO encapsulation, well named classes/methods/variables), then we're okay -- we can use it as a starting point, and improve on it. In terms of sensibility of structure, suffice it to say that script.aculo.us proved very frustrating. I posit that no significant improvements to script.aculo.us could be made without a complete overhaul.

Thus, I have begun creating one. I hope to make them available soon. Stay tuned.