Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

An introduction to Mate and why we need it. Reviews problems with Cairngorm and PureMVC.

Published in: Technology, Education
  • Be the first to comment


  1. 1. An Opinionated Introduction to Mate by John Blanco
  2. 2. Mate is, quite simply, another MVC framework for Flex. What is Mate? Yes. And now someone wrote another one called Mate. And I’ll try to explain why it’s easier to use and more powerful. But didn’t someone already write Cairngorm?
  3. 3. <ul><li>Working with modules is tricky. </li></ul><ul><li>Service Locator/Delegates are bulky. </li></ul><ul><li>Bulky boilerplate code everywhere. </li></ul><ul><li>No solution for Views. </li></ul><ul><li>It’s 2008. </li></ul>What’s wrong with Cairngorm?
  4. 4. <ul><li>Working with modules is tricky. </li></ul><ul><li>Proxy class is awfully coupling. </li></ul><ul><li>MASSIVE boilerplate code everywhere. </li></ul><ul><li>DRY principle violated consistently. </li></ul><ul><li>THE CASTING IS DRIVING ME MAD@&! </li></ul><ul><li>Mediators are singleton only. </li></ul><ul><li>Cross-platform-ness means it’s not Flex-y. </li></ul><ul><li>Debugging a nightmare. </li></ul>What’s wrong with PureMVC?
  5. 5. <ul><li>Working with modules straightforward. </li></ul><ul><li>Loose coupling everywhere. </li></ul><ul><li>Virtually no boilerplate code. </li></ul><ul><li>No casting! </li></ul><ul><li>N Views can be populated at once. </li></ul><ul><li>Native events used for communication. </li></ul><ul><li>Debug! </li></ul>What’s *right* with Mate?
  6. 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! Who wrote Mate? Is it open source?
  7. 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. 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. 9. Events are subclasses of…Event! 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. 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. 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
  12. 12. Let us look at some examples, shall we?
  13. 13. Questions?