RJS - What the the advantages? / Why use?

Hi,

I’ve read up on RJS and understand the concept/how-to-use. It’s still not clear in my mind when and why to use RJS? Can anyone drop in a couple of bullet points re advantages + when/why would RJS make sense?

Thanks

I've read up on RJS and understand the concept/how-to-use. It's still not clear in my mind when and why to use RJS? Can anyone drop in a couple of bullet points re advantages + when/why would RJS make sense?

Not really a bullet point, but RJS/ajax makes building a "video player" extremely easy and very friendly... for my player I have a list of channels, a playlist, and the video itself.

Click a channel and the only thing that updates is the playlist/video. Click on an entry in the playlist, only the video updates. Click the "next page" link in the playlist, and the playlist updates and the video...

Click the "add to favorites" and the only thing that updates is that link with a message that now reads "remove from favorites".

Basically it stops me from having to refresh the entire page for every action...

-philip

Tks - so from the point of ease in coding javascript there is an advantageous. What about from a design/architecture/performance perspective?

Note I’m asking about the RJS templates concept, not about AJAX (i.e . one could I assume build an AJAX type feature with or without RJS).

Greg Hauptmann wrote:

Tks - so from the point of ease in coding javascript there is an advantageous. What about from a design/architecture/performance perspective?

Most applications are multilingual, so most applications should put as much code as possible in one language. Ruby makes "Domain Specific Languages" spectacularily easy, so you should only write raw SQL if you can't find an ActiveRecord way to do things, and you should only write raw JavaScript if you can't find an RJS way to do things.

The advantage is you can refactor freely, and improve your design, architectures, and development speed, by putting code together by the affinity of its concepts, not by what language it happens to be in.

Curiously, I prefer Builder::XmlMarkup over the raw HTML in rhtml files. But HTML is special where we must preserve compatibility with graphic designers...