 |
 |
|
|
|
Slacker - A PureMVC/Flex Deferred Instantiation Demo |
|
Monday, 18 August 2008 |
|
The simplest startup scenario for a PureMVC-based Flex or AIR app is that the MXML application creates itself first, then the PureMVC appraratus attaches itself to the app by registering Mediators for the already-constructed view components.
But Flex has a powerful feature called deferred instantiation of view components. It can help your application's startup performance, but it can complicate your code a bit as well. Understanding the default behavior with regard to this feature is essential to any Flex developer, regardless of whether you are using PureMVC. In a ViewStack, for instance, although several children may be defined in the MXML, only the first visible child will be instantiated by default (creationPolicy="auto"). The other children will be instantiated only when you navigate to them. This is nice because it helps startup go faster, and the user may not navigate to all the children, so time and memory is conserved. Unfortunately, now our simple scenario above is no longer enough, because at startup time, we don't have references to all the view components that will eventually need mediation - they haven't been created yet!. Although we could register the mediators and later give them references to the view components as they are created, that sort of defeats the point of deferred instantiation. So we need to defer the creation and registration of the Mediator as well. View the demo and read the Release Notes for Slacker, and you'll get a much better idea how to use Flex's deferred instantiation to enhance your application's perceived responsiveness and conserve memory.
One thing to note here: Deferred instantiation is great, but OPTIONAL. If the children of the ViewStack or TabNavigator are few and simple, then instead of jumping through hoops trying to deal with deferred instantiation in the framework, be a slacker and simply set creationPolicy=all in your ViewStack and be done with it. All the children will be available when on creationComplete and you can just attach your Mediators. This advice is only for the simplest cases!!! Deferred instantiation is the default behavior because it is expected that you want the most optimal startup experience. And if you have a ViewStack with many children it may take a long time to instantiate them, leading to a slower perceived response time. And since the user may never navigate to these children, it is wasteful of memory as well.
|
|
Who's on PureMVC.org
We have 17 guests online
|
|
PureMVC on the Web
|
João Pescada has produced a nice PureMVC / AS3 demo - a searchable image gallery. |
|
Jonathan Campos has put together a nice introductory PureMVC article with an example built around the Netflix API. • Netflix API with PureMVC - Article
|
The guys over at Pyjamas (a Python port of GWT) have made their compiler so efficient that it can take virtually any Python library and it will compile to Javascript. They loved the look of PureMVC Python, and decided to do a couple of demos that use it. • Pyjamas Project • EmployeeAdmin Demo: Original / Pyjamas • Pyjamas PureMVC Timesheet Demo |
|
Chandima Cumaranatunge, co-author of the O'Rielly book AS3 Design Patterns, and long-time PureMVC community member recently created a simple Flash/AS3 MultiCore demonstration application accompanied by an informative article that's an excellent introduction to the benefits of working with MultiCore. • Who Moved the Cheese? - Demo / Source / Article
• ActionScript 3 Design Patterns |
|
Ahmed Nuaman has published a well conceived and received AS3/PureMVC tutorial at FlashTuts.com. It's a good place for the learner to get their feet wet, and goes into the difference between using PureMVC with Flex as opposed to Flash or pure AS3. • Understanding the PureMVC Open Source Framework • FlashTuts Website • Ahmed's Website
|
|
Recent Project Activity
|
PureMVC Standard Version for Perl 1.0 has been released, complete with unit tests and online documentation. • PureMVC Standard Framework for Perl
|
|
Release 1.3 of the AIR DesktopCitizen Utility which allows applications to remember their window size, position and maximized/minimized state
each time it is launched. It also provides a facility for requiring
confirmation (or executing some shutdown process) before the application
window closes.
• AS3 / AIR Desktop Citizen Utility • CodePeek Demo |
|
The classic PureMVC EmployeeAdmin Demo has been ported to yet another language! Although PHP is usually thought of as a server language, using PHP-GTK, Sasa Tarbuk recreates th a desktop app. |
Version 1.0.8 of the PureMVC Java MultiCore port is now available. It supports JavaFX and handles threading properly.
|
|
The PureMVC Java MulitCore GWT EmployeeAdmin Mobile Demo has been released. Using Google Web Toolkit 2.0, it runs on iPhone, iPad and Android. |
|
|