2 minute read

I’m currently working on a project which has a Flex front-end talking to a ruby on rails back-end. Someone recently asked me what I thought of Flex, and my response is below. I’ve only been working with Flex for a couple of months, so it’s very possible that there are solutions to the problems listed below. If anyone knows a better way of doing it, please let me know.

Overall, I find the Flex (and ActionScript 3) world annoying and less productive than either ruby or java.


Testing is weak in AS3. FlexUnit doesn’t provide dynamic test suites (see my post on Dynamically generating FlexUnit test suite). Flex cannot create dynamic classes, so we cannot create dynamic mocks. We would like to mock out flash classes (such as DisplayObject), but instead, we are stuck with stubs and other work arounds. There is no way to run a single test, so we have to compile the whole thing and run the entire suite in the browser.


ActionScript 3 feels like a weird hybrid between java and javascript. It allows you to specify the types in variable declarations and methods. If you don’t specify a type, you get a warning, so the code winds up being completely statically typed. They removed much of the flexibility of ActionScript 2 (for example, no more eval), which is part of the reason that mocking is hard. It feels like I’m back in java but without the tool support (for example, cglib).


The main IDE is Adobe Flex Builder, which is based on eclipse. Flex Builder provides some nice features like syntax highlighting, autocomplete, and debugging. However, its compiler is slow and we constantly have to wait to run our code. Refactoring is limited to rename. There is no code formatter built in.


I prefer rake over ant, but FlexUnit provides a bunch of ant tasks instead of command line tools. We will probably move towards a rake/ant hybrid at some point. We were also seeing weird issues where test failures would fail the build on macs, but not on linux. The tools all seem immature.


Flex is new and sexy, and it is fun to see the output of what we make. However, whenever I switch from ruby/textmate to flex/flex builder, I groan a little. If you want to develop Flex without using an IDE, at least make sure you install the debug version of flash in your browser. That way, when things blow up, you will see stack traces. The regular version of flash will swallow all errors without any indication of what went wrong.