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() {
      setSiteUrl("http://danielroop.com/users");
    }
  }

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

  1. Pat says:

    Thanks for the article. I too am curious about Model-Glue:Flex but I’m curious where you found your learning material from, since the getting started docs that came with it are wrong (missing files) and there is no other documentation? Did you just hack your way through it or did you find some other resource? If so, could you share any other tutorials you have found? Thank you!
    -Pat

  2. Daniel Roop says:

    @Pat

    Most of what I learned, I figured out by just looking through the examples, and the quick start guide. Sorry I couldn’t be more help.

    If you are looking for some info on it, I think Adogo is trying to get a connect session with Joe Reinhart for one of their next meetings. Might be worth tuning in for.

  3. Cliff Hall says:

    Hello Roop,

    Just happened across your post and wanted to to clear up a spot of bother with it since it concerns my framework, PureMVC.

    You say:
    >>
    Model-Glue Flex is an order of magnitude better than the other frameworks I have seen for Flex, namely Cairngorm and Pure-MVC.

    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.

  4. Daniel Roop says:

    @Cliff

    Thanks for the feedback. First I would like to thank you for putting out a framework as developed as PureMVC. Like I said in my post I have not actually had the time to implement it myself, I am just going based on documentation and hearsay.

    I believe you are right in Cairngorm you end up with a 1 to 1 mapping, but in Model-Glue Flex you end up with an Event that can dispatch X events, that in turn can have Y listeners. 1 to 1 mapping between the event and the finally handler doesn’t exist in Model-Glue Flex.

    That being said, I would probably change my wording in the statement in question to something like.

    “Model-Glue Flex and PureMVC are an order of magnitude better than Cairngorm, but from my initial research I am leaning towards the Model-Glue Flex paradigm”

    That being said my office is currently looking into using PureMVC if my boss, Max Porgres, doesn’t end up rolling his own Flex Framework with the side project he is working on.

  5. Brian LeGros says:

    @Roop – You made it onto InfoQ (http://www.infoq.com/news/2008/01/flex-mvc) under the positive comment for Model-Glue : Flex. Maybe this will get some more development going on in the framework. Of course, maybe people will realize that Flex is already easy enough to work with and frameworks over complicate its use. I’m probably nuts though, so I should be ignored.

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>