Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: arch_101's StartupCommand vs BestPractice's ModelPrep & ViewPrep commands  (Read 4622 times)
kouri
Courseware Beta
Full Member
***
Posts: 28


View Profile Email
« on: December 13, 2007, 02:40:58 »

Hi,

I can't catch differences and (dis)advantages between :

- the use of an unique SimpleCommand class registering model and view once (like StartupCommand in arch_101)
and :
- the use of a multi command class calling his turn, two simple commands (ModelPrepCommand and ViewPrepCommand) as described in BestPractices doc

Thank's for your answer.
Logged
Henk
Newbie
*
Posts: 8


View Profile Email
« Reply #1 on: January 04, 2008, 05:22:53 »

This is a question that I have as well.

I'll go a step further (risking ire and despair of the PureMVC guru's)...

The Facade class has protected methods for initializeModel and initalizeController. These are called by initializeFacade during facade instantiation.

Would there be a problem with registering proxies and commands in these methods in the concrete facade? The motivation is pure pragmatism. You don't have to look in three or more different places just to find out what is being instantiated during startup.

I can see why registering the mediators at this point is a problem since these depend on instantiation of the views.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: January 04, 2008, 08:15:27 »

Hi Henk,

I suggest reading the API documentation for those methods to get a more complete answer. From my blackberry I can't read them at the moment, but I'm fairly sure they explain this.

The initializeView and initializeModel methods are intended as hooks to allow you to use your own View or Model implementation. They cannot practically be used for preparation of Model and View.

The reason is that the Proxy and Mediator classes extend Notifier, which fetches a reference to the facade when they are created. This is how they send notifications.

Now if the Facade is still being created at the time, then there isn't an instance to fetch yet.

This will leave the mediators and proxies unable to communicate.

-=Cliff>
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: January 04, 2008, 08:20:27 »

Kouri,

I would suggest signing up for the arch101 courseware beta. The next chapter refactors the model into a common package used by multiple apps. In this case the PrepModelCommand comes from a separate package than the ViewPrepCommand which is unique or local to each app.

-=Cliff>
Logged
Henk
Newbie
*
Posts: 8


View Profile Email
« Reply #4 on: January 08, 2008, 03:11:31 »

The initializeView and initializeModel methods are intended as hooks to allow you to use your own View or Model implementation. They cannot practically be used for preparation of Model and View.

Ah I understand,
Thanks Cliff
Logged
Pages: [1]
Print