Why I don't like Flex

Michael Forrest
Mon 21 Apr 2008
Thought I'd offset my love-related etching from yesterday with a Flex rant...

Using Apple's UI development tools has helped to clarify the benefits of a template-based approach to UI development. Under that mantel I include things like Flex, .NET, Java Struts and Tiles - anything where you use a parameterised components to build a user interface. There are two benefits to a system like this:

1. initial speed of development
2. consistency of look and feel between applications

I say initial speed of development because I have always found that as time goes on, these 'easy, fast' systems tend to result in code that is difficult to maintain as the complexity grows (although you could say that about anything really... I'm really saying that the 'easyness' fosters a certain 'bricklaying' style of programming that is tedious to change due to excessive copy-pasting of details instead of OOP centralisation).

The Apple stuff brought point 2 home - it's very important for an operating system to maintain a look and feel between applications. That's where this sort of thing belongs. The good thing about the Apple implementation is that there are lots of very high quality components and integration hooks that can be used to rapidly build a fancy looking application. Also, since Apple themselves use these tools, their construction is optimised for real world use.

Here's the rub: Consistent look and feel is a no-no for Flash applications. The whole point of using Flash is differentiation of UI concepts, creating branded experiences, creating something unique every time. So Flex is generally more of a hinderance than a help when it comes to building RIAs for the web.

Flex MXML source code looks like bad HTML. As a sometime HTML developer, seeing X and Y coordinates hard coded into my view structure makes my blood itch. Seeing visual implementation details randomly mixed in with structural details scares me. I am deeply concerned that the templating language of Flex has learned nothing from all the progress that has been made cleaning up HTML over the years.

I hate the 'data provider' paradigm. It never works. It was never enough for a .NET app, and it won't be enough for a Flex app. There's always something you need to change that the component API doesn't let you change, so you end up jumping through artificial hoops imposed by the incomplete component implementation.

When you develop parameterised components, you are adding redundant functionality to your code. You try to second-guess future implementations, but you never think of everything. The more flexible a component, the fatter it is. Which is why a Flex application takes so long to download. Watching a progress bar on a website before I can do anything makes me want to leave straight away.

The other facet of this sort of encapsulation is the inevitable event maelstrom. To make a component flexible enough for use in a real world app, it needs to be dispatching events all over the place. And in my experience, the one you need is always missing. It's okay if you have the source code - you can add in an event at the point you need it, but it's never quite right.

Another problem with component encapsulation is that when you have a lot of classes going into your component's implementation, you end up having to override a whole inheritance chain to change a small detail. Um... that is, say you want to change the font on a button inside a combo box - you have to override the combo box to use a different list item class that uses a different button component which creates a differently styled textfield. Unless the developer happens to have implemented that all-important 'kerning' parameter that your designer is insisting you perfect...


So yeah. I don't like Flex because it
1) encourages lazy development practices by purporting to be 'fast' and 'easy'
2) mixes view with model with controller in XML files that can only get bigger
3) creates artificial barriers to the level of customisation necessary for any Flash app with the flawed 'state' model
4) has an ugly default look and feel
5) has components that don't quite do everything you'd expect (try using the keyboard or mouse wheel on some things and you'll see what I mean)
6) results in a lot of tangled up event listeners

I see all of these problems as coming from the parameterised component paradigm, although if the implementation was as good as Apple's then I might be a bit more interested. However, even with Apple's implementation I quickly found myself wanting to return to a code-based UI construction process, cos, you know - why hard code x and y coordinates all over the place when you could have a couple of static constants in your source and work everything else out at runtime?

6 comments on "Why I don't like Flex"

Elliot Rock says

March 23, 2009 19:09

Michael,

Interesting read and very good points. I am an old school flash developer and have just thrown myself into flex as even job that I see asks for it.

First the change to a new IDE was great, in my 9-5er I use one of the worst IDE (SWiSH Max and SWiSH Max2 <- Which I helped develop) and Flash cs3 and 4 for after hours contract work. Flexbuilder was a good move to get my experience 'up' on serious a IDE.

I enjoyed the process of using a new environment and system. Building quick UIs is its nature.

The first cringe came on export, I build full template sites that weigh under 100kb so a single module at 300-400kb scared me. All this time learning to produce efficiently with as2/3 :) I know there are techniques to share component resources and caching.

Their is a part of me that likes the application, module and component system. The extra events to communicate between these is nice but nothing great as it is pretty easy to have call back functions in a parent/child relationship - it is sort of how I build the newer dynamic swish templates. Using separate encapsulated swfs has its advantages in large content sites, if you think in a template manner and share these physical resources as much as possible.

As I mentioned at the start I am still in the early stages of learning Flex and posts like yours are interesting.

cheers
E

Elliot Rock says

March 23, 2009 19:22

I need to rewind a bit with my comments in regards to my current salary position and SWiSH Max1/2.

The event handlers of max1 and max2 where a lot better to code with that the per-frame and attached to object manner of as2 via Flash. Max2 finally allows for external script files to be loaded and compiled on export/publish. Overall > 2yrs ago the manner in which you coded procedurally was better than flash, especially the non-offset level button event handlers (dog I hated on() events).

The object physic was great as well. Check

http://www.swishzone.com/product/max/demos/swf/ballgame_physics.html

As an example.

rewind complete, where is the comment edit button Mike:)?

Elliot Rock says

March 23, 2009 19:22

I need to rewind a bit with my comments in regards to my current salary position and SWiSH Max1/2.

The event handlers of max1 and max2 where a lot better to code with that the per-frame and attached to object manner of as2 via Flash. Max2 finally allows for external script files to be loaded and compiled on export/publish. Overall > 2yrs ago the manner in which you coded procedurally was better than flash, especially the non-offset level button event handlers (dog I hated on() events).

The object physic was great as well. Check

http://www.swishzone.com/product/max/demos/swf/ballgame_physics.html

As an example.

rewind complete, where is the comment edit button Mike:)?

Michael Forrest says

March 24, 2009 06:32

Hi Elliot - thanks for the comments, and apologies for the lack of edit button :-s (how ironic that I had that sort of feature on my ASP-based blog about 6 years ago yet I still haven't put it onto this Rails thing...).

The swishzone link doesn't seem to work (sorry - I really should at least have a 'preview' option before commenting, shouldn't I!). Anyway.

Did you come from my LinkedIn post?

I think I'll paste it in here anyway - this was in response to the question "If you are a Flash developer - are you or have you learned Flex and if so, why?"

The official Flash Authoring tool is not an IDE by any stretch of the imagination. Any coder who places any value on their sanity would have jumped into an external tool by the second or third serious attempt to create any sort of Flash application. Anything more complex than a one-directional timeline animation with no interactivity should be considered an 'application'. There is no way to create a Flash application without bugs and inconsistent interactivity without using ActionScript.

When AS2 first started to become a viable language, Sepy was the editor of choice. This was a decent free editor, and streets ahead of the Flash Authoring environment. As time went on, it became possible to break the dependency on FLA files entirely, and applications could be created using the open source tools MTASC and Swfmill. And soon came FDT, an Eclipse-based ActionScript editor that was a quantum leap ahead of the Flash IDE and a massive improvement over Sepy (I should also mention FlashDevelop at this point as a tool in a similar league to Sepy).

The team making FDT struggled to integrate ActionScript 3 support, and they have come up with a questionable pricing scheme which makes it a difficult tool to recommend, and it does not have the marketing clout behind it that Adobe can offer to promote Flex Builder, but even WITH the occasional bugs experienced using the latest version, it is still significantly more powerful than Flex Builder. If it makes using the Flash IDE feel like going back to the Stone Age, it makes Flex feel like the Iron Age at best.

What surprises me is that Flex has become shorthand for 'serious' Flash development, when in reality, as Xavier said, you can't use it for sophisticated design, which surely is the primary reason to use Flash! I would add that you also can't use it for anything lightweight and fast (imagine if the YouTube video player was written in Flex!), and you can't seriously use progressive enhancement principles and you can't create anything that conforms to even the most basic of accessibility standards.

You need to understand that the question is not Flash or Flex. It is Code or Not Code. Flex is a stepping stone to writing proper code, but it is extremely limiting, and the chances are that you will find yourself needing to dive into some extremely bloated Adobe AS3 files to complete tasks as mundane as changing the down state for the font on a button. If you want to write something good, you should probably be using FDT as your editor, and you should be learning OOP techniques and learning all the design patterns you can get your hands on.

Elliot Rock says

March 24, 2009 20:36

We are in the same group that your post above id from :)

http://www.swishzone.com/products/max/demos/swf/ballgame_physics.html

Is the correct link, it needs 1 quirk with an axis getting swapped in one of the vectors.

I agree with the comments especially in the last part of that post. I will check out FDT as you mention. I have never been more excited using AS3 and OOP techniques, as the possibilities are fantastic.

Sitting on my shelf is AS3 Design Patterns!

Nice tunes BTW, I am from NZ so love good music esp Electronic styles. I use to run a dance club in Chch - southern Hemisphere capital of D&B.

Peace

Michael Forrest says

March 26, 2009 07:10

Hehe, well, just making sure those thoughts didn't get permanently buried away from Google :)

Your link gives me a 404 still :(

Probably needs a login or something.

Anyway cheers, and I hope you get round to reading the design patterns book! Not that I ever really did... I seem to have absorbed most of what I know by osmosis from colleagues..

Make a comment