Friday, March 25, 2005

Do, or do not -- never ask why

So I've been working on enhancing the, already excellent, AJAX support in Rails. But I've never really talked about the Why.

I like that Rails made AJAX so simple to use. But as I watched Sam's excellent demo, I realized that it was refreshing the entire list of 'elements' every time it returned data. Which is, as they've said, the simplest approach... But I've done that kind of thing before, and after a while the browser can bog down moving that much HTML in and out of the DOM. Not that I'm pointing fingers, but IE is especially bad about memory bloat when a lot of HTML flies around in javascript.

So, natch, I thought that it would be a good idea to cut down on as much repetition as possible and stop re-rendering every 'element' when only one has changed. Having said that, I also didn't want to over-complicate it. Especially since I just went off about certain technology groups over-architecting things.

And that is how, rather why, I got this AJAX bug up my, uh -- in my head. :-D

By the way, I'm polishing up an app I've thrown together as an example of using AJAX to only update the data that's changed. Yes, *sigh*, it is yet-another task list. But it's simple, and therefore good for an example. Plus, I'll provide the source so you can pick it apart and dig into the AJAX stuff. Look for that early next week.

No comments:

Post a Comment