ruby, Technology

Flex Remoting in Ruby? Easy Choice.

I’ve had a rocky relationship with Adobe Flex.  An awkward attempt to migrate an existing app to Flex caused several strong reactions and cost a good bit of developer goodwill.  The details of that decision are messy and irrelevant.  The experience sucked.

On the other hand, I could not have built the FeatureFrame technology without Flex.  There’s no simpler way to build a widgetized video player with embedded applications.  The same pains of horrible documentation, irrational design decisions, insidious bugs, and painful workarounds remain, but the things it makes easier pale in comparison to the obstacles of any other approach.

And of course in building a virtual world such as Elf Island, Flex is an obvious choice if you want to play it in the browser and build maintainable code (binary Flash files make a poor foundation for a sustainable product).

For most languages you might want to build a Flex app in, free, open options are available.  I had a recent need to prototype a solution that might also turn into a test fixture for our vendors to use in producing Flash apps, so Rails seemed the natural solution for simplicity of deployment and prototyping speed.

The main choices to support Flex Remoting calls in Ruby are RubyAMF and WebORB.

In trying to decide, I encountered a very useful comment in this thread:

"The biggest difference between what WEBorb provides and what RubyAMF(only
AMF alternative I am aware of) provides is workflow.  Weborb is a great
product written by guys who do java primarily.  So it follows the patterns
of having a Service layer that connects you to your application.

RubyAMF is written by a ruby developer."

Immediately, I know what my choice is.  WebORB is obviously the trap of over-architecture and suffering that pervades “correct” Java development.  A quick search on how to use RubyAMF (in a controller) confirmed my suspicions:

respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @people.to_xml }
format.amf { render :amf => @people }

When I see code like this and compare it to the WebORB or GraniteDS implementations, I just can’t imagine choosing those other paths.

Rails + RubyAMF is concise, clean and obvious in what it’s doing.  Yes, please.

3 thoughts on “Flex Remoting in Ruby? Easy Choice.

  1. So concise the way RubyAMF plugs into the controller’s respond_to block. I should probably write-up Red5 server, which is a (free) replacement for an (expensive) Flash Media Server to stream, broadcast, or record video on the interwebs.

    Keep the Rails-Flex development info coming!

  2. I agree. We switched over to rubyamf for our flex code from Soap about a year ago. We saw an instant performance boost from 10 second requests to 2 second requests (Our return objects are huge) Rubyamf saved my project.

Comments are closed.