What is Mate?
Mate (pronounced “mah-teh”) is an open-source framework from ASFusion. It is similar to Cairngorm from a high level because:
Mate is a lightweight microarchitecture for building Flex RIAs and manages the application’s data flow and event flow.
The view is only updated via data-binds to the model.
The view dispatches events upon user gestures.
The controller (called an 'event map') executes the appropriate command (or 'event handler').
Commands ('event handlers') are the only system parts that may update the model, as the view never updates the model directly.
My top 3 favorite things about Mate:
It is relatively easy to swap out Cairngorm for Mate without deep refactoring of the app’s parts. The application is not tightly tied to either framework. And both frameworks have the same high-level dataflow. To use Mate, you simply have to extend what you already know about Cairngorm.
The event handler system allows extensible mappings, instead of Cairngorm’s FrontController which only allows 1:1 event/command mappings. Also, event handlers are expressed as MXML instead of ActionScript, providing a structured modeling approach instead of a “code it however you want” approach. Following is an example of 8 events mappings being defined in Mate. In Cairngorm, it took 16 ActionScript files (8 events; 8 commands) to implement what this one single file does in Mate: http://mate.asfusion.com/assets/content/examples/cafeTownsend/srcview/source/com/cafetownsend/maps/MainEventMap.mxml.html
The documentation for Mate is detail oriented and comes with good example applications that illustrate how to use it. In this site I will make references and include links to source code examples that I found in the official docs.
Here’s 2 applications that are functionally equivalent. One’s in Cairngorm, and the other’s in Mate:
Cafe Townsend Cairngorm: http://mate.asfusion.com/assets/content/examples/cafetownsend_cairngorm/srcview/
Cafe Townsend Mate: http://mate.asfusion.com/assets/content/examples/cafeTownsend/srcview/
Here's a great article that describes Mate from top to bottom:
Official Mate homepage:
Harry's List of Links: