Steven,

 

Take your point, just wanted to see if there was anybody else that had come across this

or found any different solutions.

 

Not wanting to get the view helper on demand was just a small point of style, it just

made sense to get the view helper in the constructor. Like you said though,

clarity before brevity.

 

Cheers,

Mike

 


From: Steven Webster [mailto:[EMAIL PROTECTED]
Sent: 18 February 2005 13:21
To: [EMAIL PROTECTED]
Subject: RE: [flexcoders] Cairngorm and deferred instantiation

 

Michael,

 

There's really no harm in the strategyof locating the 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 is that 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 get the 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 wouldbe 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