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: Does mediator sendNotification to proxy or they can call directly ?  (Read 18008 times)
fidiman
Full Member
***
Posts: 23


View Profile Email
« on: September 22, 2008, 01:20:41 »

Hello,

I'm new to here.

I'm started by a simple question, i think.

Does mediator sendNotification to proxy or they can call directly ?

thanks.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 22, 2008, 02:07:27 »

Proxies cannot receive Notifications. This is to keep them portable; not dependent on the use cases and notifications defined by the view and controller regions.

the mediator may retrieve and interact with the methods and properties exposed by the Proxy.

To understand why this would be so, always consider the possibility that your domain model may be reused in a different application with different use cases. The Flex browser-based app might provide walk-up, ever-present web based functionality while a desktop version adds more powerful features for working with data locally and interacting with other desktop apps. Still yet another mobile version might add a ui that makes quick queries against the same remote services.

You have one model and 3 very different apps. So the model should be internally self-consistent, but unaware of the business of the app its a part of.

But from each app's perspective, that model is at the core of their reason for existence. To represent it and allow the user to interact with it. So a relatively intimate familiarity with the model can be expected in the controller and view tiers.

Thus Proxies send but do not receive notifications, while Mediators and Commands may retrieve and interact with Proxies directly.

-=Cliff>
Logged
fidiman
Full Member
***
Posts: 23


View Profile Email
« Reply #2 on: September 23, 2008, 12:05:45 »

very clear !

thanks !
Logged
fidiman
Full Member
***
Posts: 23


View Profile Email
« Reply #3 on: September 23, 2008, 12:56:15 »

So, sendNotification is used in mediator only for communicate with other mediator ?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: September 23, 2008, 04:46:36 »

Or to trigger a Command.

-=Cliff>
Logged
fidiman
Full Member
***
Posts: 23


View Profile Email
« Reply #5 on: September 23, 2008, 04:54:43 »

ok, thanks
Logged
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« Reply #6 on: September 26, 2008, 04:58:56 »

Need to say that it took me some time to understand it,
so just to make clear

 ---------------------------+----------+---------+
 |   - actor -              |  send    | receive |
 ---------------------------+----------+---------+
 |  view (mediator)         |   yes    |   yes   |
 ---------------------------+----------+---------+
 | controller (commands)    |   yes    |    yes  |
 ---------------------------+----------+---------+
 | model (proxies)          |   yes    |    no   |
 ---------------------------+----------+---------+

Is it better to send notification from view or better to call command that will do that? What is better habit?
« Last Edit: October 31, 2008, 02:41:41 by marek » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #7 on: September 27, 2008, 05:00:49 »

Regarding when to trigger Commands and when to simply manipulate Proxies directly from a Mediator, see: http://forums.puremvc.org/index.php?topic=476

-=Cliff> 
Logged
fidiman
Full Member
***
Posts: 23


View Profile Email
« Reply #8 on: October 02, 2008, 11:53:30 »

thanks guys...
Logged
Pages: [1]
Print