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: Anatomy of a chain of events  (Read 6195 times)
landed
Full Member
***
Posts: 37


View Profile Email
« on: May 01, 2009, 10:05:09 »

Just want to see if I have this right from what I can tell.

Objective : have a UI element send data to the model process that data and display a result in the same (or not) UI. Must keep encapsulation.

UIView > dispatchEvent to its Mediator
UIViewMediator > sendNotification(include value object or other data) to a controller (which controller)
UIViewController > sendNotification(include value object or other data) to ModelProxy
ModelProxy > sendNotification(include value object or other data) toModel - do thing and then go all the way back.

I have left out the facade here on purpose as I would like to see how it could be done using that. I think how I have it here is more traditional MVC, with pure I seem to be seeing that I can go straight to the Model with facade ?

thanks for developing this thread...
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: May 02, 2009, 06:10:48 »

Three things that are wrong:

1) Command not Controller. Their is just one Controller and it executes Commands mapped to Notifications.

2) The Command retrieves the Proxy and gives it the data. The Proxy 'has no ears'; it cannot receive Notifications. If it could, it would be too tempting to have it listen for notes defined elsewhere in the app, making it less reusable. (Always assume you'll reuse your model tier classes in another app).

3) By using sendNotification, you've already used the Facade. sendNotification is a convenience method that uses the local reference to the Facade that every Command, Mediator or Proxy already has.

-=Cliff>
Logged
Pages: [1]
Print