Half-Penny For Your Thoughts

rounded down to the nearest cent



Categories


Recent Articles




Graffitiwok

jQuery and GraffitiWok

So, GraffitiWok is heavy on the javascript, heavy on the ajax-y goodness, etc. I started out using Prototype. Actually, Prototype worked pretty well, but I became frustrated with it. It does so much that it was making it difficult to get my own custom code going. So, I tried mootools, but that ended up causing some weird problem slowing down everything. I gave up and went back to prototype.

Later, I started needing to do some remote form submittal. Rails has helpers to generate the code Prototype needs, but it’s pretty nasty code if you don’t have the helpers. And I didn’t feel like writing them. That’s when I found this slide show, which shows some advantages of using jquery. Particularly, it’s easy to use without all those Rails helpers (Prototype is a bit too Rails-centric, in my opinion). For a js-heavy app, I wanted to have that control to not need to rely on helpers in my views that I didn’t understand.

So, I started with jquery, and the excellent array of available plugins. I have no intention of using prototype again. Jquery may not be the best js library out there (and no doubt which is best depends on the usage), but I find it much easier to use than prototype.

I did miss one thing with prototype, which was it’s “class” structures that look and feel more like Ruby than the typical javascript class structure. But, then, Prototype messing with javascript at all sorts of levels was one of the things that got on my nerves, so I was in some ways glad jquery does build in that kind of thing. Instead I went searching for a separate library.

This base.js script does the trick nicely, and it’s a separate piece that I can add in to a project or not, instead of one monolithic library that just does too much. Combined with jquery and a few choice plugins, it saved me a lot of time on the javascript for GraffitiWok.


blog comments powered by Disqus