PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: f_tamy9 on August 21, 2008, 07:49:18



Title: slacker example initialize model approach
Post by: f_tamy9 on August 21, 2008, 07:49:18
  I'd just started the AS3 and flex with pureMVC last week.
  I did not get the idea of missing the Slacker Model on : http://trac.puremvc.org/Demo_AS3_Flex_Slacker/browser/trunk/src/org/puremvc/as3/demos/flex/slacker/model (http://trac.puremvc.org/Demo_AS3_Flex_Slacker/browser/trunk/src/org/puremvc/as3/demos/flex/slacker/model)
  I read on release note about the Mode on:
1. The Main MXML Application (Slacker) gets the ApplicationFacade instance *during* its creation.

2. This initializes the Model, View, Controller and Facade instances, and registers STARTUP/StartupCommand with the controller.
  How Slacker initializes the model?

  I did not find the proper place for registerProxy calls. Shall we do it in StartupCommand or else?
Thank you in advanced.  :)


Title: Re: slacker example initialize model approach
Post by: danielcsgomes on August 21, 2008, 08:04:36
Hi f_tamy9,

Yes, you should initialize the model in the StartupCommad, this example doesn't have Model because it is about of handling Deferred Instantiation.

Daniel Gomes


Title: Re: slacker example initialize model approach
Post by: f_tamy9 on August 22, 2008, 10:56:28
Hello Daniel Gomes
  Thanks for your comment!  :D
  In my opinion it is better to add a proxy to load some stuff (e.g. a few images) to show Deferred Instantiation in a clear manner.

Regards, F.Tamy


Title: Re: slacker example initialize model approach
Post by: danielcsgomes on August 23, 2008, 01:14:18
Hi Tamy,

Take a look on the demo i created, it handles with Deferred Instantiation and handle it in a different way. see it on this post:
http://forums.puremvc.org/index.php?topic=639.0

Today i will post the link with the all source files (database,php,as3 e mxml).

Daniel Gomes


Title: Re: slacker example initialize model approach
Post by: f_tamy9 on August 23, 2008, 08:46:58
It is a cute example Daniel!  :)
We did the same via a SWF document class.

F.Tamy


Title: Re: slacker example initialize model approach
Post by: puremvc on August 23, 2008, 09:45:47
Hi Folks,

This example is focused on deferred instantiation within the View.

The Model should be initialized first, but it should not make any eager remote calls that will require the View to be prepared and ready when they return.

Thus the natural extension of this is that the Model be prepared, then the View, followed by any Commands that require both to be in place, such as causing Remote Proxies to fetch their data and subsequently populate the View by Notification.

Although the demo would be more complete if it did this, it would be much more rambling than the existing one. I was thinking this morning, about this very problem, and thinking perhaps of turning it into a tutorial, with the steps you need to extend it to do some typical but simple work with the Model. If I get time for this I will try to work it in.

-=Cliff>


Title: Re: slacker example initialize model approach
Post by: f_tamy9 on August 26, 2008, 10:32:17
Thanks Cliff!
  If I got your idea clearly, model should initialized first with few constant hard coded data. ???
  Preparing a tutorial is necessary for extending the Slacker if you could do it.  Do your best please.
Cheers,  :D
F.Tamy