Model Glue Flex

So I finally got a chance to play around with the alpha of Model-Glue Flex and I must say I am rather impressed. I never got a chance to use the ColdFusion version of the framwork, but Model-Glue Flex is an order of magnitude better than the other frameworks I have seen for Flex, namely Cairngorm and Pure-MVC. I have to admit that I have not used Pure-MVC myself, I have just read a few how-to documents and am basic my assumptions on that. That being said, here is my initial reaction to Model-Glue Flex.

The first thing I like about it is there seems to be considerably less “boiler-plate” code to get started. It seems that the guys over at Firemoss attempted to make this as simple as possible, and in doing so they have made a very powerful Event System that doesn’t try to control too much about your application design. I believe that Model-Glue Flex brings to Flex what Fusebox brought to ColdFusion, that is a simple way to handle requests without dictating too much design.

Flex being a stateful environment I think the Model-Glue methodolgy works very well, even more so than ColdFusion. Flex exposes an event system that other frameworks attempted to build upon and enhance, but it seems that Model-Glue Flex is not using this event system and if it does it just uses it to kick off handling of it’s own event/message system. The message is really the key to the power and it comes from the fact you don’t assign listeners to events, but to messages that are dispatched by events. Any event can kick of any number of messages, and two events can kick off the same message. This allows the handling of events to be de-coupled from the dispatching of events which I believe is a flaw in the other systems. When coupled you end up with a 1 to 1 mapping of events to handlers that destroys any benfits that an event system provides for you.

One of the things I didn’t like about the framework was that in the quickstart guide it promotes the use of value objects and a delegate for all of your work. This is what my friend, Brian LeGros, would call a Lightweight architecture. This kind of architecture seems to be a common approach in the Adobe community, and I would like to see a lot more Heavweight approaches. The Ruby Community would call these “Fat Models”. It is the idea that your objects know how to perform actions on themself instead of having “manager” classes to manipulate “beans” or “value objects”.

After realizing seeing the lightweight architecture I felt compelled to re-implement one of the Model-Glue Flex examples using a more Heavyweight approach, and although I haven’t taken the time to do that yet, I think I might in the next couple weeks. An even more interesting idea came next though, and I really hope someone takes this idea and runs with it. The idea was Flex ActiveResource. I have seen a lot of RoR/Flex cross over, and I think this bridge would be even stronger if someone took a look at the Rails ActiveResource implementaiton and made a Flex port, so that implement a Rails RESTful interface was as simple as something like:

  public class User extends ActiveResource {
    public User() {

and then you coulde interact with the object like:

   public var danielroop : User = User.find('first', { where: 'username  = "danielroop"' };

Maybe one day I will take the time to implement this, but I would much rather just be able to take credit for the idea, and have someone else do the hard work of implementing it!

Side project ideas aside, I think Model-Glue Flex is a step in the right direction for Flex frameworks. I hope the beta, and public releases continue to improve and stay as simple and elegant as they are currently.

This entry was posted in programming and tagged , , . Bookmark the permalink.

5 Responses to Model Glue Flex

Leave a Reply

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