In this beginner session we’ll see how to setup your first PureMVC based on a proven project template. We’ll lay down the groundwork and add new features to evaluate the strengths and weaknesses of the framework.
While the examples shown will be specific to Adobe Flex 3 for deployment to the browser, this session is equally relevant for application developers of other technologies including Adobe Flex 3 for Adobe AIR desktop deployment.
1 of 13
Download to read offline
More Related Content
Samuel Asher Rivello - PureMVC Hands On Part 2
1. PureMVC: Next Steps & Conclusion
Adobe Flex 3 Microarchitectures Series
Samuel Asher Rivello
Principal, RivelloMultimediaConsulting.com (RMC)
Certified Designer & Developer (Adobe Flash)
2007 Adobe Systems Incorporated. All Rights Reserved.
2. PureMVC
Next Steps
• Recap Today’s “Hello Google” Project
• 10 Tips for Using PureMVC
• PureMVC Alternatives
• PureMVC.org Website
• References, SourceCode
2009 Rivello Multimedia Consulting. All Rights Reserved.
3. PureMVC: Recap
The Framework
• A framework is a collaborating set of design patterns
• Learning a framework is a very worthy investment to empower your team
to build bigger, better projects
• PureMVC is a framework separates M,V,C logic in your app to enable
teamwork, maintainability, and extensibility
• UI, VO, and actors of PureMVC shown in diagram below
2009 Rivello Multimedia Consulting. All Rights Reserved.
4. PureMVC: Recap
Hello Google Sample App
• Silly, but simple & complete
example using PureMVC
• The user clicks a Button which
populates a TextField with text
from Google’s homepage.
• Entire Interaction from UI Button
click to server call/response to
update UI TextField summarized in
diagram to right
TextField
Button
2009 Rivello Multimedia Consulting. All Rights Reserved.
5. PureMVC: 10 Tips – 1 Through 5
1. Think in (Pure)MVC
• How do I start using PureMVC? Short answer: Just think in MVC!
1. Proxies = Model
2. Mediator and View Components = View
3. Commands = Controller
2. Create an API for View Components
• A View Component might be a standard UI component (e.g. DataGrid) or a custom
component (e.g. a world within a game) or whatever. Don’t use its public methods directly.
Use its Mediator as a wrapper to create an API.
3. Use one Mediator for multiple View Components
• To closely coordinate more than one View Component, use just one Mediator to control
them all.
4. Let Events bubble up
• Bubble events from the nested children of a view component up to the mediator.
5. Communicate using Noti cations as often as possible
• It’s a bad practice to change a Proxy (Model) from a Mediator (View) directly without using a
Command (Controller).
2009 Rivello Multimedia Consulting. All Rights Reserved.
6. PureMVC: 10 Tips – 6 Through 10
6. Use Commands / MacroCommands as often as possible
• Once code is in a command, simply send the appropriate noti cation from anywhere to
repeat its execution.
7. Use Remote Proxy to send and receive server-side data
• This is HUGE! If the server’s API changes, you will only have one area of your code to change.
Very convenient encapsulation.
8. Unregister unused Mediators
9. The Power of VO’s (Value Objects)
• View Component has no access to the Model data directly.
10. Practice, Practice, Practice
• Do a few demos from scratch to learn the basics
• Build time into your rst production project to learn-as-you-go!
2009 Rivello Multimedia Consulting. All Rights Reserved.
7. PureMVC
When to Use PureMVC (or a Framework in General)
• When scalability and maintainability are more important than rapid execution
• When the project feels more ‘application’-like (Many UI controls / Discrete business
logic) than ‘game’-like
• Medium to Large Projects (> 100 Man hours)
• Team Projects ( > 2 Developers)
• Long Term Projects (> v1.0 in discussion)
My Opinion: Once expertly trained on PureMVC teams work faster
with PureMVC than a custom solution.
• Faster Architecture Stage
• Faster Implementation (Debatable)
• Faster Meetings / Discussions
• Faster Development of Post-v1.0 Features (By Far)
2009 Rivello Multimedia Consulting. All Rights Reserved.
8. PureMVC: Alternatives
Flash Platform Frameworks
• Cairngorm - http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm
• Mate - http://mate.asfusion.com/
• Swiz - http://code.google.com/p/swizframework/
• Others - ARP, MVCS, Flest, Model-Glue: Flex, ServerBox Foundry, Guasax, Slide, and
many many more…
• Comparison of Frameworks
• http://puremvc.org/content/view/43/98/
• http://www.adobe.com/devnet/ ex/articles/ ex_framework.html
2009 Rivello Multimedia Consulting. All Rights Reserved.
9. PureMVC: vs. Cairngorm: The Very Basics
In Cairngorm, typically you:
• De ne the ModelLocator class as a Singleton.
• Add properties to it.
• Fetch the ModelLocator Singleton at various places in the View by calling its
getInstance method.
• Bind to its properties.
In PureMVC, you:
• De ne proxies to hold the data
• Register them with the Model, typically via the Facade
• Retrieve the Proxies elsewhere with Commands or Mediators
• Set the data on the View Components with Mediators
2009 Rivello Multimedia Consulting. All Rights Reserved.
10. PureMVC: vs. Cairngorm: The Major Parts
PureMVC Cairngorm
Model Model
View View
Controller Controller
Command Command
Facade CairngormEvent
Proxy Delegate
Mediator Service
Noti cation
More Info: http://geekglue.blogspot.com/2007/10/cairngorm-vs-puremvc-quick-comparison.html
Pros & Cons: http://robsondesign.com/demo/framework_comparison/
2009 Rivello Multimedia Consulting. All Rights Reserved.
11. PureMVC: Website
PureMVC.org
• Downloads
• Documentation
• Examples, Showcase, Forums, News
• Plug-in Utilities
• State Management
• Startup App Loading Management
• Much, Much More…
2009 Rivello Multimedia Consulting. All Rights Reserved.
12. PureMVC: QA
Any Questions on The Topics Covered?
Section 1: De nition and Bene ts of PureMVC
Section 2: PureMVC Applied
• Adding PureMVC to your project
• Using my PureMVCTemplate
• Building “Your First Project”
Section 3: Next Steps, QA, & Conclusion
• 10 Tips for PureMVC
• Comparison to Other Frameworks
• References & Links
2009 Rivello Multimedia Consulting. All Rights Reserved.
13. PureMVC: References & Thank you!
SPEAKER
• Samuel Asher Rivello| Principal, RivelloMultimediaConsulting.com (RMC)
• RMC Services: Software Architecture, Consulting, Development, & Training
• Specializes in PureMVC Architecture
• Business Cards Available
PureMVC on the EDGE!
• Article Published: “An introduction to PureMVC for Adobe Flash and Flex” on Adobe’s EDGE newsletter a
http://www.adobe.com/newsletters/edge/december2008/articles/article6/)
REFERENCES SPECIAL THANKS!!!
FULL DOCUMENTATION TO TODAYS TALK
• Contact 360|Flex PUREMVC AUTHOR
ARCHIVE OF TODAYS VIDEOS
• Cliff Hall
• Contact 360|Flex
MY OTHER PRESENTATIONS • http://www.puremvc.org
• See ‘Blog’ on RMC link above. (Post a Comment!) • Email & Contact – See Website
PUREMVC
• http://www.puremvc.org
• ADOBE FLEX 3
• http://www.adobe.com/products/ ex/
2009 Rivello Multimedia Consulting. All Rights Reserved.