For one of the product we are currently developing for ourselves, we want to create a very slick interface. When we started, I was doing some Flex work at that time, so we (I) decided to start building the UI in Flex against a RESTFul Rails application. I used Cairngorm and I spent 10 days over several month developing the main functionality. I created a Flex ActiveResourceClient class (Actionscript) to access our RESTFul Rails server. I found a nice mechanism to display Rails errors in Flex similar to what scaffolding provides. I managed to add some Flex charting to show time series. We also nicely integrated testing with rake to allow running Flex unit tests from rake (rake test:flex). All was good. All was good, if it wasn’t for a little feeling that coding was slowing down. And it was getting a little slow to add new features. And I wasn’t so sure any more that we really needed flex for that project. So as the server was RESTFul, I thought why not use Adobe’s SPRY framework that consumes XML to drive HTML generation in Javascript. And our Rails application returns XML. So I devised a nice way to integrate Spry with Rails. I thought let’s give it a try. Four hours later I had a working demo, and 12 hours later a working application. The result was a cool application that behaves like Gmail. Erb was used to generate Spry templates and once the client was loaded (html+javascript) only calls to get new data from the server where issued. Then came RailsConf 2007 and my vacations (without any computer). Well, coming back to the project I wondered if I really needed Spry and if I could just go plain old Rails for the views. So on I went back and rewrite once more the UI just using standard Rails views. Eight hours later I had a clean, simple UI.
Lessons learned: keep it simple, don’t use technology for technology, don’t find a problem to your solution. Well, I got to enthusiastic about trying out new stuff, but now we are back on track.
So, 10 days for Flex, 12 hours for Rails+Spry, and 8 hours for plain Rails. Now this comparison is not fair as we spent quite some time on integrating Flex and Rails. But definitively when a Flex application becomes quite large, the compile time causes a drag to the development time. This is compared to plain Rails where you can just keep doing changes at which ever level you want (model, controller, view) and instantly see the change, resulting in a way faster development cycle. Don’t take me wrong I love Flex, but for this project Rails is a better fit.