Thanks for throwing me a line, like I said im new... I guess John 
Mark was one of those guys that never had to ask questions. he's 
cooler than me for sure. (btw any helpful/ unhelpful/ thoughts/ 
blasts/ etc are completely appreciated) For the record I would rather 
not "muck" with Cairngorm.


> I think when Shannon is talking about components he's talking 
about modules in fact. In that case, each module has its own 
controller. In that scenario, if you dispatch an event and that event 
(same event type) is registered in two different modules, the two 
commands in different modules will be fired.

You rock! You totally get it! 

I agree that passing target/unique/random instance identifiers and 
then filtering on that identifier before acting on a cairngorm event 
is probably the best solution, but I really feel like im hacking. In 
fact I am guessing that cairngorm never was intended to handle this, 
and the discussion can probably stop here, but I would greatly 
appreciate it if someone can flush out my ignorance and tell me that 
cairngorm was either never designed to handle this or (I can dream) 
that it has some elegant solution? 

For the sake of John Mark, here is a use-case that emphasizes the 
problem, hope it helps: 

1. Each Component works as stated above, a single ViewHelper 
encapsulates the components behavior in a well recognized/documented 
Cairngorm fashion. 

Am I on the right track so far?

2. A. Component A is a checkout page that asks the user to fill in 
billing and shipping information. It contains two instances of 
Component B (a cairngorm address entry component) as Billing and 
Shipping forms*.

3. Component B (Instance 1 (Shipping Information)) contains field D 
(zip code)

4. Component B (Instance 2 (Billing Information)) contains field D 
(same component, new instance)

5. User fills out shipping information (noticing the billing 
information is updating because of the ties to cairngorm 
architecture) Thinks this is cool. 

6. user moves on to billing form and selects "90201" from a list of 
zip codes in the billing form.

7. ViewHelper dispatches CairngormEventDispatcher.getInstance
().dispatchEvent(zipChangedEvent);

8. FrontController is listening to this event for both forms and 
fires the UpdateAddressFormCommand (twice, once for billing and once 
for Shipping [hopefully you recognize the problem at this point])

8. The updateAddressFormsCommand sees the information for that zip 
code is cached locally (let's stave two calls to the server) and 
overrides the users entries for the shipping information while 
updating the billing information. 

9. User is very sad and closes the browser.

In the end I am looking for a solution that will help me adopt 
Cairngorm in my organization (without trying to change it. Trust me 
when I say I would really rather understand than override) 

I just want to learn to this and do it their way. 

* <view:AddressViewHelper id="helper" /> in my component and two 
component instances in an application causes an error because only 
one instance of the Helper with id="helper" is allowed. Instantiating 
this using AS3 within a script tag works because (I think) it isnt 
being instantiated as intended.


Reply via email to