Wednesday, January 7, 2009

Flex + Rails = Flexible Rails -> Rich Internet Applications

The wave started in 2007 when Simeon Bateman presented Building Rich Internet Applications with Flex and Ruby on Rails @ Rails Euro Conf. Both Rails and Flex are two great tools to quickly develop nice looking and compelling applications.

For those who don't know Rails -> Type Ruby on Rails on google and the result will overwhelm you :)

Quick introduction to Flex:

* Flex is cross platform development framework for creating RIAs, Desktop applications
* It is component based. Coding is done in MXML (Macromedia XML), ActionScript 3 (Object Oriented, Strongly type)
* Flex Builder and SDK are used for design and code view
* Flex 3 framework is Open Source
* Compiles in swf file which runs in Flash Player ref in HTML page
* Support RESTful API

A typical communication that happens between Rails and Flex component:



Worldwide ubiquity of Adobe Flash Player 9 Sept-08 -> 89.4%.

Recently published book by Peter Armstrong (Manning Publication co.), explains the seamless integration through RESTful APIs. Another one is talks about why Flex is better than using Javascript and CSS.

In our project we were looking for a component to bulk upload documents (always painful). Flex gave the power to bulk upload documents and integration with Rails was pretty straightforward. browse() and upload() method of FileReference class does the whole magic.

Wanna Test the Flex Component ?
For geeks who like to test every piece of code they write Flex 3 provides FlexUnit, a unit testing framework for Flex and ActionScript 3.0 which mimics JUnit and comes with graphical test runner.

The beautiful flex component:



Wanna try the power of Rails combined with the flexibility of Flex ??

Code to come shortly

No comments: