Adobe Flex For Software Engineers

I have to admit when I first experienced Adobe Flex, the successor to Adobe Flash for rich internet application development, I thought it was a fragile toy that wasn’t good for much more than pretty moving pictures.  At my current day job, I had to not only learn it, but spend about half my time working in it (as opposed to my current favorite language, Java).  One thing I’ve learned from the experience is that it wasn’t so much Flex that I had a problem with, as much as Flex Developers.  The Flex developers I’ve worked with up until this job came to Flex from being Illustrators, Graphic Artists, or just kinda fell into it.  They never learned the art of software development, never learned to appreciate best practices, and never learned to value code quality or readability.  But as a long-time Software Engineer, I know you can create bad software in any language.  But now I’ve spent about 10 months working in Flex, and feel I can opine fairly.

Visual Work

When I started doing more serious page layouts, I though that I was back working in HTML with table layouts.  Great.  Then I remembered the problem of using tables for layout in HTML wasn’t the mechanics of it, but the semantics of it.  Tables are for representing data in columns, not laying things out on a page.  The Flex containers are designed for layout, so it “makes more sense” to use them for that.

The properties of these containers used to shape and align these containers and controls can be quite confusing and inconsistent, but they are powerful.

The Language

The programming language behind Flex and Flash is ActionScript.  In fact, FlexBuilder compiles Flex down into Flash and ActionScript, which is why it can be played in the same exact Flash Player.  As a Java developer who spent a lot of time with Perl, PHP, Python et al in the past, it frustrates me to once again be working with weakly-typed variables that can contain anything you can imagine.  It makes runtime debugging a necessity.

Objects in ActionScript are like associative arrays (Map<String, Object> for the Java folks out there).  When you declare an object to be of a particular type, you can think of it as creating an array containing certain properties, some of which are functions (methods).  What happens after that is anyone’s guess, as properties can be added and taken away arbitrarily.

Scope rules in ActionScript are like “frontier justice”.  You can declare a variable inside a for loop, and it will still be there with its last value outside the loop.  At least packages work in a way you would expect.

Connection to the back end

Flex actually does shine here, for the right combination of front end and back end.  Adobe made it pretty easy to pass serializable objects between a Java back end and a Flex front end.  A layer called AMF deals with most of the messiness, but there are gaps.  For instance, since ActionScript has no concept of enumerations, they kinda haveta be faked.  There are also several MVC frameworks if you’re into that kind of thing.

Quality

FlexBuilder, the IDE, is built on Eclipse.  It’s not bad, but it leaks memory like a sieve, so expect to shut down and restart it once a day.  The real quality problem is in the SDK itself.  I’ve run into many situations where the debugger stopped at an error in the SDK code caused by poor quality code that didn’t verify whether operations succeeded or expected parameters were really there.  Some of the most basic objects, like List, are the worst offenders.  I spent about four hours today just trying to get a List to sort.  Never got it working.  We’re using a tree control at work that has four bugs reported against it because we haven’t figured out how to work around the underlying tree’s limitations and bugs.

Portability

You can look at this from two different angles; portability from a developer point of view, or portability from a user point of view.  From a Developer point of view, the picture is not pretty.  Adobe had a beta version of a FlexBuilder port to Linux.  They’ve since abandoned the effort, leaving cross-platform developers in a pinch.  I believe the SDK still runs under Linux, but with no IDE it would be difficult to develop new software using it.  Personally, I’m very surprised they gave up on a Linux version, given how much there is to gain by doing so.

Conclusion

For real complicated applications, unless there was no other practical ways to do what you want, I would stay away from it.  Other than that, it’s worth a try,    But given the capabilities of modern-day JavaScript libraries, and the promising features in HTML5, I would have to think hard about recommending going this route for everyone.

Share

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.