Flex Frameworks – PuremVC, Mate, Cairngorm and Robotlegs


Objective

I just wanted to share my thoughts about the frameworks in the Flex environment. You may have noticed that I am in love with Spring when I write Java code, but how about Flex? For a simple example application I go with KISS (keep it stupid simple) approach, but for serious data driven app I utilize a framework.

How to choose a framework that works for You

Firs of all you need to know what you are looking for, because if you do not know where you are going, any path will take you there. When I first started to p[lay with Flex about 3 years ago, I noticed that I need to add some structure to the application. Since I was already using Spring I started looking for a framework. At that point in time there where only two alternatives worth looking at: Cairngorm (heavily pushed by Adobe) and PureMVC.

To select a framework I used both framework to build a simple sample application. After spending a day on the exercise I chose PureMVC. PureMVC solution was cleaner, it suited my need better and I felt that it did a better job at structuring the application. I stuck with PureMVC fro quite a while, Until couple month ago I decided to take a look of something better came along.

All the hype was around this English word "Mate", meaning friend or buddy. Even some developers around me have deep religious belief that Mate will save the world. So I had to take a deeper look at this framework. I build a simple application to get a feel for the framework and found that I do not like quite a lot of things about Mate.

First of all everything is done in the sudo code called MXML. I like writing code, I like to have control and make things exactly like they should be and generated code not allays works exactly like I need it to. Then I started looking into some other aspects of the Mate framework and found a better solution. If you are interested in a deeper reading about what I do not like about mate here are couple posts from Shaun that I agree with:

AS3 Dependency Injection and [Autowire]
Another Architectural Framework, But Why?

After looking around I chose to use Robotlegs Framework. It gave me exactly what I needed: dependency injection, mediators and proxies. What you need for your application may be completely different and you may choose another framework, but give robotlegs a good look over to see if it will fit your need too.

Conclusion

Select a framework with a particular need in mind, don’t just use one because Adobe pushed it or your mate recommended it. Understand framewrok’s pros and cons and choose the one that give you the most bang per line of code or xml if that is your coding flavor.

Let me know in the comments which other framework you have used and would recommend to others.

2 thoughts on “Flex Frameworks – PuremVC, Mate, Cairngorm and Robotlegs

  1. Hello… I used MATE in a very big project and it was terrible. Aground the unclear MXML-Event-Maps I’ve lost track of instances and data-flow. Any developer used a own structure. And endless data-binding need a lot of time after application-launch. Event-Maps in MATE are display-objects: A bad way!!!

    I think PureMVC is a very clear way to implement big flex-projects. Use PureMVC, drink Mate! More in German-Language: http://blog.division-durch-null.de/2010/04/flex-frameworks-puremvc-vs-mate/

    In view of my experience with MATE I do not like use a framework with “injection”… although robotlags has a good architecture.

  2. Glad someone warned me about mapping being done on display objects in MATE… I guess I can skip it as performance is one of my bigger issues!

    I very much enjoy the robotlegs architecture, and while I do not fully understand how the DI works under the hood it’s dead easy to implement. Since portability is kind of a minor issue for me, I tend to prefer robotlegs over PureMVC because it utilizes the event API fully. That being said, I think you should select a framework based on your needs AND those of your fellow developers, not just the cool factor.

    It just happens to be that native event handling and DI solves many problems I deal with daily, without complicating it too much for me or my collegues.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>