Well I’ve finally reached a point in my latest AIR application where I can write up a useful review of the framework I chose to use: Mate.

In my continuing effort to avoid Cairngorm, I’ve been evaluating other Flex frameworks that are lightweight, rapid and comprehensible. In the application previous to this, I implemented PureMVC, and while I did not get to use all of the features, I did think it was a greater balance of ease and power than is Cairngorm, but was still rigid on implementation.

Less Regulation

For me, the purpose of any design framework is to enforce some standard patterns to create a scalable, flexible application, while allowing the actual implementation up to the developer and architect. Cairngorm does not fit this idea, and PureMVC came close, but still heavily regulated how the application was structured and implemented.

Mate, on the other hand, simply provides the mechanisms for enforcing a design pattern, while allowing more creativity and flexibility on how to implement it. Foremost to this is its use of the native event model in Actionscript for handling the application behavior. The tags provided by Mate simply add a layer of abstraction on top of this system that makes it both more powerful and more flexible (not to mention easier to learn).

Another concept that I found attractive is that you can break up your application into very granular pieces when you are creating a large project, but also have the ability to combine aspects together for a small application with only a handful of views and events.

Want to combine your event handlers and property injectors into the same file? No problem. They even provide different examples on their site that shows different implementation styles.

Tag Based Abstraction

I can’t gush enough about the tags available in Mate. Again, another benchmark for me on a valuable framework is how much menial coding it does for me. Hmm, that sounds familiar to another tag-based technology that I enjoy so much. What was that called again?

How do you get objects returned from a RemoteObject call injected into the view? It can’t be much more simple than this:

<Injectors target="{MyModel}">
   <PropertyInjector source="{MyEmployeeManager}" sourceKey="employees" targetKey="arrEmployees" />
   <PropertyInjector source="{MyProjectManager}" sourceKey="projects" targetKey="arrDivisionProjects" />
   <PropertyInjector source="{MyResourceManager}" sourceKey="resources" targetKey="arrPhysicalResources" />
</Injectors>

How about event handlers? It makes it real easy to find what you’re looking for when you have a tag named EventHandlers with child tags called RemoteObjectInvoker and MethodInvoker.

<EventHandlers type="{EmployeeEvent.GET_ALL}">

   <RemoteObjectInvoker ...>
      <resultHandlers>
         <MethodInvoker generator="{MyEmployeeManager}"
                  method="handleResponse"
                  arguments="{resultObject}"/>
      </resultHandlers>
   </RemoteObjectInvoker>

</EventHandlers>

Less Code!

Ever seen a Hello World example written using Cairngorm? I have and it’s not pretty. I even wrote up a demo on our internal Wiki for a Hello World application using PureMVC. It wasn’t much prettier. It required 12 steps to explain all the mechanisms involved.

In Mate, the required code to get a remote “Hello World!” string and display it in a view in almost laughably simple in comparison. They have a view injection diagram on their site that is a nice representation of how it works in the Mate framework.

Give Mate a try

In case the tone of my opinions in this article wasn’t a giveaway, I am a fan of Mate. It’s definitely something I’m going to keep evaluating for our future applications. I still have one more framework to look at – Swiz – which a colleague of mine has already starting investigating. What he has shown me so far is also impressive.

All in all, I’m glad that there are now frameworks out there that deliver on the promise of power and flexibility instead of just power.