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: Mediators to Mediators  (Read 6135 times)
Lazerwonder
Newbie
*
Posts: 2


View Profile Email
« on: April 07, 2010, 02:24:09 »

Hi,

I'm just starting to use pureMVC and I have a couple of questions... (I don't want to break any pureMVC BP and rules):

1. I was wondering -- is it okay to use notifications to talk from mediators to mediators?  Or do I have to have mediator #1 to talk to a command, which dispatches another notification that mediator #2 will be interested in?

2. Parent mediators *can* have access to children mediators... question is, is this a BAD thing to do?  Like, if in a mediator, I'm registering another mediator... and then in that parent mediator, I want to access a function in that child mediator... is that breaking any BP or rules?


Thanks. :)
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 08, 2010, 08:56:56 »

1. I was wondering -- is it okay to use notifications to talk from mediators to mediators?  Or do I have to have mediator #1 to talk to a command, which dispatches another notification that mediator #2 will be interested in?
Not a problem. Mediator to Mediator communications is a perfectly fine way of creating view hierarchy that doesn't need top-down command logic to achieve self-organization.

2. Parent mediators *can* have access to children mediators... question is, is this a BAD thing to do?  Like, if in a mediator, I'm registering another mediator... and then in that parent mediator, I want to access a function in that child mediator... is that breaking any BP or rules?
Though a Mediator may create and register another Mediator for a child of it's own view component, it shouldn't puppeteer that new Mediator anymore than it should its own view component. Don't keep the reference to the new Mediator. Send it a notification to it like any other decoupled entity in the system.

-=Cliff>
Logged
Pages: [1]
Print