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]
Author Topic: Regarding keeping model and view decoupled -Proxies should know about Mediators?  (Read 3032 times)
Karl Macklin

« on: May 31, 2009, 03:41:16 »

I'm still learning the nuts and bolts of this framework, so maybe this is really easy.

In any case, I wonder if mediators should be allowed to know about proxies. My first personal guess would be "no, that would couple the view and model too tightly". But perhaps this is not the case. I keep seeing mediator code (in the hello flash example, and Renji an PureMVC game for example) which keeps reference to data proxies.

For example in hello flash example:
// Retrieve reference to frequently consulted Proxies
   spriteDataProxy = facade.retrieveProxy( SpriteDataProxy.NAME ) as SpriteDataProxy;

My thought seeing this was "but.. isn't that what we're trying NOT to achieve?".
Jason MacDonald
Sr. Member
Posts: 243

View Profile Email
« Reply #1 on: May 31, 2009, 08:28:10 »

It's fine to have mediators call Proxies for simple reads/writes. Anything more complex, or used in mutplie places, should go in a command for reuse.
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #2 on: June 01, 2009, 06:31:52 »

When in doubt go back to basics:

Look at the diagram of the classic MVC pattern here:

The Model notifies the View.
The View is notified by the Model of changes, and may update the Model directly.
The Controller is notified by the View and may update either the Model or View directly.

Pages: [1]