Hi Steve,

I'm going to take a stab at this as I've been studying the Command 
pattern (as defined in GoF) and Cairngorm lately. In fact I'll be 
presenting on the subject here in Boston tomorrow evening, so this is 
right up my alley. (www.bfpug.us)  :-)

 > how do you handle 6 different results since there is only 1
 > onResult function.

I think that the answer here is "you don't".  :-)

Cairngorm has a SequenceCommand which has:

public var nextEvent : CairngormEvent;

You can then call its executeNextCommand() from your result() method 
which launches that event.

This will work well enough if you need results from command_1 before you 
make the service call in command_2, which you need before command_3, etc.

On the other hand, if that's not the case, what to do?

The Gang Of Four chapter on the Command pattern describes a MacroCommand 
that executes a number of (Simple)Commands. As described it seems to 
simply fire them off, one after another. Wouldn't be hard to roll your 
own, extending ICommand, with an array property, and passing in Command 
objects.

I could even see creating an MacroEvent class that kept track of whether 
its Commands had finished and that then did something when all were 
finished.

Other Cairngorm programmers, wiser than I, will probably ask you wise 
questions about why you wish to pull data from six different data 
sources...  :-)


Douglas


-------------------------------------------------

Douglas McCarroll

CairngormDocs.org Webmaster
http://www.CairngormDocs.org

Flex Developer
http://www.brightworks.com
617.459.3840

-------------------------------------------------






stevehousefl wrote:
>
> I have a command that I would like to have pull lookup data from 6
> different BusinessDelegates. Should that one command call all 6
> delegates or should it fire 6 new events that call 6 new commands?
>
> If the one command should call all 6 delegates in its execute
> function, how do you handle 6 different results since there is only 1
> onResult function.
>
> I am using Cairngorm 2.1.
>
> Thanks in advance,
>
> Steve
>
>  

Reply via email to