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: Commands as Proxy handlers  (Read 3547 times)
mico
Jr. Member
**
Posts: 15


View Profile Email
« on: November 15, 2011, 06:25:21 »

Hello PureMVC forum,

One of our projects has a sort of this mechanism (let's call it 'command as a proxy handler') which works as follows.

E.g., we have an application with a popup and sort of a logging system. The popup saves data using remote method and after result is retrieved it launches some Notification (ProxyResult). We also have a Command (the name is not correct because it doesn't represent any actions - ProxyResultCommand) that closes that popup and sends a success message to the logger.

The alternative approach (and a classic I guess) is to listen that Notification in Mediator that manages popup and the Mediator.

What is the best solution? What to apply if we have a set of actions (close popup 1, close popup 2, send something to Logger). If this can be used what is the best name for this Command?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: November 15, 2011, 08:43:34 »

The popup saves data using remote method
Actually, the Proxy should be the one doing this. You might take info from a popup and use it to invoke a Proxy, but you shouldn't have the Popup itself talking to a remote method. Did you mean 'The proxy saves data using remote method'?

-=Cliff>
Logged
mico
Jr. Member
**
Posts: 15


View Profile Email
« Reply #2 on: November 16, 2011, 12:38:15 »

Yes, of course, Popup doesn't save data directly - it saves it via Proxy
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: November 16, 2011, 09:02:41 »

What to apply if we have a set of actions (close popup 1, close popup 2, send something to Logger).

It may be better that the Mediators that have the popups open be interested in the result note so that they can close the popups. And you could have a LoggingCommand be registered to that same note so that it will be triggered and can write to the logger. You can also have LoggingCommand be registered to other note names as well, so it can be reused.

So you have two Mediators and a Command independently responding to the result note rather than one Command that tries to coordinate the response.

-=Cliff>
Logged
Pages: [1]
Print