This document provides an overview of the Mate MVC framework for Flex, comparing it to other frameworks like Cairngorm and PureMVC. It outlines some of the key issues with Cairngorm and PureMVC, such as bulky/boilerplate code and tight coupling. The document then describes the main components of Mate - models, views, events, and event maps - highlighting how Mate addresses these issues through loose coupling, minimal code, and native Flex events. It concludes by giving a brief example of an event map configuration.
2. Mate is, quite simply, another MVC framework for Flex. What is Mate? Yes. And now someone wrote another one called Mate. And Ill try to explain why its easier to use and more powerful. But didnt someone already write Cairngorm?
3. Working with modules is tricky. Service Locator/Delegates are bulky. Bulky boilerplate code everywhere. No solution for Views. Its 2008. Whats wrong with Cairngorm?
4. Working with modules is tricky. Proxy class is awfully coupling. MASSIVE boilerplate code everywhere. DRY principle violated consistently. THE CASTING IS DRIVING ME MAD@&! Mediators are singleton only. Cross-platform-ness means its not Flex-y. Debugging a nightmare. Whats wrong with PureMVC?
5. Working with modules straightforward. Loose coupling everywhere. Virtually no boilerplate code. No casting! N Views can be populated at once. Native events used for communication. Debug! Whats *right* with Mate?
6. Mate was created by AS Fusion -- Laura and Nahuel. While the source code is freely available, you can not contribute back any changes without going through one of them. However, they are extremely active on their forums and very willing to improve the product based on recommendations! http://mate.asfusion.com Who wrote Mate? Is it open source?
7. Models are regular classes. No inheritance needed. Does not need to be a singleton. Does not need to be static. Just make a model. :-) The Elements of Mate: Models
8. Views are regular classes. No inheritance needed. XML or AS is fine. No knowledge of models or controllers needed (or desired). Just make a view. :-) The Elements of Mate: Views
9. Events are subclasses ofEvent! No CairngormEvent or Notification classes needed. Fire regular events. This means that we can pull out components and we have no dependency on Mate. Very clean. The Elements of Mate: Events
10. Event Maps are the only place you will ever put Mate-specific code. The event maps weave together models and views in myriad ways. Event maps, in general, will handle events by binding data to views, calling methods (like Commands), serve as Mediators, and even invoke network processes and handle returns! The Elements of Mate: Event Maps
11. <!-- Debugger --> <Debugger level={ Debugger.ALL } /> <!-- Event Handlers --> <EventHandlers type={ CalculateEvent.TOTAL_COST } debug=true > <MethodInvoker generator={ CartManager } method=calculateTotal /> </EventHandlers> <!-- Injectors --> <Injectors target={ CartView }> <PropertyInjector targetKey=total source={ CartManager } sourceKey=total /> </Injectors> The Elements of Mate: A Quick Event Map Example