Michael,
 
There's really no harm in the strategy of locatingthe view helpers "on demand" where you need them, in the
execute(), onResult() or onFault() methods; is your motive for creating them in the constructors simply to
save on typing out the ViewLocator.getInstance.getViewHelper( "..." ) ? 
 
I'd go for clarity over brevity every time
 
Steven

From: Michael Herron [mailto:[EMAIL PROTECTED]
Sent: 18 February 2005 11:12
To: [email protected]
Subject: RE: [flexcoders] Cairngorm and deferred instantiation

Steven,

 

The problem isthat the front controller for the entire application will still be instantiating all the required command classes at start up.

The command classes in turn will use the view locator in their constructors to get the view helpers they need.  So even though the

command hasn’t been called and doesn’t actually need to use the view; it is still trying to get an instance of the required view helper.

 

Sorry if im not making this totally clear! Like I said, the other solution is to only getthe view helper instance when the view is required,

i.e. in execute(), onResult() and onFault().

 

The perfect solution? Cairngorm components with completely self contained services, controller and view locators would be fantastic… ;)  Seriously

though, I do see your point, it is an architectural problem that needs more thought.

 

Sorry for the lack of details, I can write up a fuller description if required.

 

Cheers, 

 

 

Reply via email to