Monday, March 27, 2006

AJAX -- where to start?

Tonight I wanted to delve into the wondeful world of AJAX. I knew better than to write my own backend library, as I figured there must be plenty of options out thre already.

Boy, was I right. I have to admit, I was a bit overwhelmed at first.

One of the trickiest parts seems to be understanding the realtionship between a bunch of the packages - and choosing one with both the right features and complexity to start off with.

At first I was leaning towards Rico - but the lack of docs, and the fact that it was built on top of Prototype caused me to have second thoughts. I decided to first understand Prototype and then go back and make use of Rico, and perhaps other libraries.

It took a tiny amount of digging, but sure enough, prototype is documented.

So what's Prototype all about? Well, first and formost, Prototype attempts to be an advanced JavaScript library, allowing you to do things in JavaScript easily. This ranges from getting a form field value, to iterating through an array. It has a nice and lisp'ish feel (lots of uses of anonymous functions), so I feel quite at home. If you do nothing with AJAX, but write plenth of JavaScript, this is worth checking out just for it's utilities.

Next, it has some components to do AJAX. This turns out to be a handful of simple objects to make communicating between a server and the browser as easy as possible. In the end, the AJAX part of Prototype isn't that large or hard to understand.

So, as I said, my next plan is to play with Prototype a bit more and try to fully appreciate it. Then, I'll graduate to Rico where I can take advantage of it's clever effects and widgets.

This stuff really is cool, and not nearly as painful to learn when you remember - there's no magic to it, it's just the same JavaScript I've been writing for years.

No comments:

Post a Comment