Reasons to choose Flex over/with Flash

At work, there has been a lot of discussion over using either Flex or Flash for projects that need to be done quickly. We are a small design shop of about 20 developers and designers, with a dedicated design team of about 8 people.

Our production manager insists that Flash is the way to go because there are many ActionScript 2 users in the group, and he insists that Flex is just too complicated for our team. The Flash team has won and Flex is now looked with disdain. I find this an unfortunate misunderstanding of the technology. Given that I was never able to participate in this dialog, this is my rebuttal.

Here is my list of reasons developing in Flex is more productive in Flash:

1. Ability to source control – Flex uses the MXML-based format, which is friendlier for programmers. Since a lot of our studio team is on CS3, it means a lot more coordination is needed to synchronize code between people. FLA is a binary format. Flex is a text-based format friendly to source control systems like svn and git. For suzuki.ca, we had 8 developers working on the same code base in Flex without any problems. For Reebok, we had 4 people working on the same project in Flash, yet ran into conflicts and had to manually marge some of our binaries.

2. BlazeDS: Our shop uses a lot of Grails. With Grails, there is a plugin called the Flex Plugin, which allows us to hot compile our Flex files into the deployment server and use Continous integration tools with them. As people keep checking in different files, we can run simple flexunit tests on them to see that they are still valid. Since the Flash compiler is close source, you would have to go through many hacky alternatives to have this level of integration.

3. High level components: Flex takes html components like tables ( grids ) and labels, but also introduces a robust set of components available only with external libraries like YUI and Dojo / Dijit. With Flash, you can really only rely on a textarea component positioned absolutely. With Flex, you can position these elements anywhere on the screen based on a coordinate system. It’s like HTML without all the cross-browser compatibility hacks. Using Flash, you would have to import external component libraries for things like tabs, accordions and navigation panes. With Flex, this is all standard and well-thought out so you don’t have to go through this hassle. No need to license shady third party components to get work done.

4. Browser Integration and Navigation: One of the most challenging aspects of Flash is the incorporation of URLs to dictate the content dictated. With Flex’s BrowserManager component, a flex file can react and influence the generation of URL parameters quickly and efficiently.

5. Native XML Support: Our usual solution involved a lot of content passed back and forth between the server and the flex client. We have chosen to use the content negotiation ability in Grails to return and update server data. Flex allows you to bind data quickly to visual components via a technology called e4x. e4x allows you to take a xml node, say myNode.@name, and bound it to a flex inputfield like ( my syntax is a little rusty because our Flex projects have dried up ). This is extremely powerful. It allows you to do things like inline table filtering and heavy data search without making various trips to the server. It is one of the most powerful, and sadly underused features of this framework.

6. Web Services Support: We use a lot of web services in our apps, and one of the nice things about flex is the built in HTTPService methods that are available as mxml tags. This allows us to quickly load data from REST-sources without much coding. In fact, our remote data acquisition code is usually less than 20 lines.

7. Better CSS Support: Flex uses a CSS syntax that is very similar / identical to the CSS used in HTML. This means that embedding images and adding things like page positioning and drop shadows is very simple. Moreover, Flex provides a technique called Scale-9, which allows you define boundaries around a button, so that you don’t have to skin them again. In Flash, you would have to make each button a symbol. In Flex, you just apply a class. Imagine how much time is saved for CSS skinners just by generating these buttons dynamically.

8. Better separation of components and logic . Flex is built with a component model familiar to both Software developers and HTML page designers. Flash is based on a movie timeline structure that has a tacked on javascript like language. Being able to separate your program into objects and components is one of the premises of Object oriented development, and it makes developing user interfaces very elegant and simple. In Flex, Actionscript can be put apart from the components they support via code-behind, allowing skinners to work on interfaces and developers to finish coding.

9. Flash is still an option: Many people like the production manager I mentioned, do not understand that Flash and Flex share a similar underlying model. You can both include movies made in Flash inside Flex applications and have them communicate with each other normally, or put them inside a sandbox. All the Flash graphics api methods are available to Flex components. You can still code transitions in tweener. Choosing to use Flex does not make all your Flash richness go away, it simply provides another tool so that you can choose the best one to use.

10. Better Debuggers: Flex builder is a real Integrated Development Environment based on Eclipse. Flash movie debugging is a joke. If you are writing a lot of actionscript, Flex Builder allows you to inspect your code quickly and identify errors without much effort. WIth Flash, you rely on dummy tools like Flash Tracer and print statements. It’s primitive and ugly. There is a tremendous amount of development effort that can be saved on projects with Flex.

11. Desktop integration: Flex has AIR, which is a runtime that allows you to extend your Flex apps into the desktop. This can be an incredible selling tool for your application, as it means that your code gets to be re-used and extended across platforms easily and seamlessly. Flash, not so much.

Resorting to a Flash only solution will only increase development time, as the wheel will need to be re-invented over and over again to accomplish many simple things that Flex does quickly and elegantly. Unfortunately, there are people that simply do not understand this technology and insist of building everything in Flash.

I am tired of screaming and shouting about this. And it’s very frustrating because you see that there is a better, more elegant solution to a lot of problems being faced in your own team, but you are helpless in solving them because there is just no understanding of this stuff. I’m frustrated and angry. Please explain to me why only Flash must be used. I have no answers.

Maybe I am wrong. Maybe Flex really is the antichrist and must not be used at any cost. I like it. It’s like being able to code HTML without having to deal with all the cross-browser compatibility issues and a native scripting language that is surprisingly like JavaScript but without the baggage of having to handle DOM trees. I like it. And that is good enough for me.

3 thoughts on “Reasons to choose Flex over/with Flash

  1. Shon SChetnan

    I come from a Flex background, so I am biased, and not knowing the overall skill-set of your team it is hard to be objective. My general view of the strength of the Flash developer tools are that they are geared toward the building of fairly sophisticated animations. The entire development tool is geared and optimized for that purpose. Flex is an object oriented development environment geared toward software developers for building rich applications. I find the data binding and the ease of consumption of services to be some of the more appealing capabilities of Flex as well as the rich component and event model. Small applications can be built very quickly.

    If you have a team of people who are experienced in object oriented development, your projects are ‘applications’ and not primarily animations, then I would definitely go with Flex. You’ll build more maintainable software faster. There is also no reason why you can’t combine the two. We’ve done that very successfully writing the application in Flex and embedding the Flash written animations.

    Reply
  2. Michael Walker

    I just have two things to say: inertia and old habits die hard. Starting with a new development is one thing (Flex wins hands down, with the appropriate level of Flash – horses for courses and all that), making changes to existing applications is another… And there is a big cost and motivational implication of re-training and re-thinking by the pure-Flash brigade…

    Reply
  3. Andre

    “Please explain to me why only Flash must be used.”

    I have a better question: why does Adobe have two completely separate applications for creating swf files, instead of combining the advantages of both into a single application?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s