Modular Flex Development
and the Mate Framework

By Gareth Edwards




                       http://qld.cfug.org.au
What we will talk about ?
●   Common Issues – What to watch out for
●   Modules – Why and How
●   Mate ( ma-tay ) - The Ba...
Common Problems
●   Flex
    ●   Maintenance of hundreds of classes
    ●   Getting Data to Nested Parts ( or Modules ) of...
What are Modules ?
●   Sub Applications compiled to SWF
    files that can be loaded at runtime




                      ...
Why Modules ?
●   Reduces size of individual applications
●   Can be loaded Dynamically
●   Can be “swapped out” for other...
What is Mate ?
●   MXML / Flex Framework
●   Inversion of Control / Dependency Injection
●   Promotes “Presentation Patter...
Mate has the fundamentals
●   Injection of Properties and / or Classes to Views and
    other Classes
●   Event Dispatcher...
EventMap / LocalEventMap
●   The Configuration MXML Files
●   <EventMap> is Global
    ●   Common uses
        –   For the...
Manager
●   Is a Class to Manage your Data
●   Common Uses
    ●   Properties to inject your Data from your EventMap
    ●...
Presentation Pattern
●   Is a design pattern
●   The most apparent aspect is the “Presentation Model”
    ●   Using classe...
Some of the EventMap Toolbox
●   EventMap / LocalEventMap
●   EventHandlers
●   PropertyInjector
●   EventInjector
●   Obj...
Event Handlers
●   Used with Built in or Custom Events
●   Common uses
    ●   {FlexEvent.PREINITIALIZE}
    ●   Custom Ev...
PropertyInjector
●   For Injection of Properties to a View or a Registered Class
    based on the Class Definition
●   Rem...
EventInjector
●   To setup function calls based on an Event.
●   Example Scenario
    ●   Change a View State based on an ...
ObjectBuilder
●   For creating instances of Classes and to allow for
    additional Injection techniques through
    regis...
MethodInvoker / ServiceInvoker
●   Used to call internal / service functions from within other
    Parent Tags such as Eve...
DataCopier
●   Used to copy data from your Manager to a scope
    accessible for further work in the EventMap
●   Example ...
Additional things
●   Use <PropertyInjector softBinding=”true” … /> when
    needing to Inject Global Properties to Module...
Resources / Comments
●   Very Active
●   Lots of Examples
●   Well Documented
    ●   Although some best practices are har...
Q&A




      http://qld.cfug.org.au
Upcoming SlideShare
Loading in …5
×

Flex Modular Development and Mate

3,059
-1

Published on

A brief look at Modular Development in Flex and the Mate framework from the ColdFusion Queensland User group meeting in August 09

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,059
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
79
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Flex Modular Development and Mate

  1. 1. Modular Flex Development and the Mate Framework By Gareth Edwards http://qld.cfug.org.au
  2. 2. What we will talk about ? ● Common Issues – What to watch out for ● Modules – Why and How ● Mate ( ma-tay ) - The Basics ● This Presentation is for people already looking at Flex ● This Presentation is mostly concepts ● Q&A http://qld.cfug.org.au
  3. 3. Common Problems ● Flex ● Maintenance of hundreds of classes ● Getting Data to Nested Parts ( or Modules ) of your Application ● Singleton ● Modules ● Sharing Events between Modules ● Sharing Data between Modules ● Populating with Data http://qld.cfug.org.au
  4. 4. What are Modules ? ● Sub Applications compiled to SWF files that can be loaded at runtime http://qld.cfug.org.au
  5. 5. Why Modules ? ● Reduces size of individual applications ● Can be loaded Dynamically ● Can be “swapped out” for other Modules ● Separating your application into smaller parts can mean it is Easier to Maintain ● Loading new Modules can mean it is easier for your Flex app to grow http://qld.cfug.org.au
  6. 6. What is Mate ? ● MXML / Flex Framework ● Inversion of Control / Dependency Injection ● Promotes “Presentation Pattern” ● Developed by ColdFusion Users ● Http : // mate.asfusion.com http://qld.cfug.org.au
  7. 7. Mate has the fundamentals ● Injection of Properties and / or Classes to Views and other Classes ● Event Dispatcher and Listener http://qld.cfug.org.au
  8. 8. EventMap / LocalEventMap ● The Configuration MXML Files ● <EventMap> is Global ● Common uses – For the Core of your application – For Authentication ● <LocalEventMap> is Local ● Events are dispatched and Handled by scope.dispatcher which is typically passed into the constructor of your PresentationModel ● Common uses – Modules http://qld.cfug.org.au
  9. 9. Manager ● Is a Class to Manage your Data ● Common Uses ● Properties to inject your Data from your EventMap ● Functions to manipulate your Data from your Event Map ● Manager is typically not for ● Dispatching Events other than property change events for binding ● http://qld.cfug.org.au
  10. 10. Presentation Pattern ● Is a design pattern ● The most apparent aspect is the “Presentation Model” ● Using classes that are typically implemented for use by a specific view, the presentation Model Encapsulates – Interaction → Event Dispatch – Model → View ● The Presentation Model Relies heavily on ● Access to data in your Managers ● Your Views having access to it http://qld.cfug.org.au
  11. 11. Some of the EventMap Toolbox ● EventMap / LocalEventMap ● EventHandlers ● PropertyInjector ● EventInjector ● ObjectBuilder ● MethodInvoker / ServiceInvoker http://qld.cfug.org.au
  12. 12. Event Handlers ● Used with Built in or Custom Events ● Common uses ● {FlexEvent.PREINITIALIZE} ● Custom Events ( {MyCustomEvent.CUSTOM} ) ● Easy to Chain Events http://qld.cfug.org.au
  13. 13. PropertyInjector ● For Injection of Properties to a View or a Registered Class based on the Class Definition ● Removes need for Parents knowing about properties that Children need ● Removes need for Singleton ● Makes dependencies easier to manage ● Works with Interfaces ● Works with Abstract Classes ● Example Scenario ● Inject Manager Properties into Presentation Model and then Presentation Model into View http://qld.cfug.org.au
  14. 14. EventInjector ● To setup function calls based on an Event. ● Example Scenario ● Change a View State based on an event ? http://qld.cfug.org.au
  15. 15. ObjectBuilder ● For creating instances of Classes and to allow for additional Injection techniques through registerTarget=”true” http://qld.cfug.org.au
  16. 16. MethodInvoker / ServiceInvoker ● Used to call internal / service functions from within other Parent Tags such as EventHandler ● Example Scenario ● {TimesheetManager} / updateWorkingDays ● {MyCFService} / updateWorkingDays http://qld.cfug.org.au
  17. 17. DataCopier ● Used to copy data from your Manager to a scope accessible for further work in the EventMap ● Example Scenario ● {TimesheetManager} / WorkingDate http://qld.cfug.org.au
  18. 18. Additional things ● Use <PropertyInjector softBinding=”true” … /> when needing to Inject Global Properties to Modules http://qld.cfug.org.au
  19. 19. Resources / Comments ● Very Active ● Lots of Examples ● Well Documented ● Although some best practices are hard to find ● Presentation Pattern is worth looking at ● Http : // mate.asfusion.com http://qld.cfug.org.au
  20. 20. Q&A http://qld.cfug.org.au

×