topleft
topright

OReilly PureMVC Book

PureMVC Book

PureMVC TV

PureMVC TV

PureMVC on the Web

PureMVC Blog-o-Sphere
PureMVC on LinkedIn
 
Image
 
Why can't Proxies hear Notifications?
Sunday, 05 October 2008

QUESTION: 

Brian at BrickaBracka asks:

 

 

Is there reason why Proxies can't handleNotification?  Seems like we are missing something.

 

QUESTION: 

From 'Best Practices and Implementation Idioms ':

 

Proxies Send, but Do Not Receive Notifications
 
For a Proxy to listen for Notifications is to couple it too tightly to the View and Controller tiers.
 
Those tiers must necessarily listen to Notifications from Proxies, as their function is to visually represent and allow the user to interact with the data Model held by the Proxies.
 
However View and Controller tiers should be able to vary without affecting the data Model tier.
 
For instance, an administration application and a related user application might share the same Model tier classes. If only the use cases differ they can be carried out by different View/Controller arrangements operating against the same Model.

 

Proxies may retrieve and act upon each other as need be, and since hierarchies naturally exist in most domain models, it isn't unreasonable to allow them to do this, since the Proxy serves to control access to the data and to maintain the integrity of the held model.

 

One might argue that Proxies need to send Notifications to each other, in order to decouple them from each other. And that's true, but it's decoupling across tiers that we're mostly concerned about with MVC, and particularly in the direction of Model to View.

 

If Proxies could hear Notifications, the unwary coder might be tempted to make a Proxy listen for Notification defined and sent from the View or Controller tier, thus coupling the Model to the View in such a way that extricating the Model tier for use in another application could be difficult.

 

So the decision to make Proxies 'deaf' to Notifications was to choose the lesser of two evil couplings.

 

-=Cliff>

Delicious
Technorati
Reddit
Furl it!
NewsVine
YahooMyWeb
Stumble
blogmarks
Digg
co.mments
connotea
 
Copyright (c) 2006-2012 Futurescale, Inc.