--- In [email protected], "Tim Hoff" <timh...@...> wrote:
>
> 
> A couple more thought on this and I welcome others to jump in. 
> Here's an example of where a custom event would be preferable to
> using public properties in components.  Similar to Peter Ent's
> example, let's say that you have four different views that a user
> could select an order from; a DataGrid view, a TileList view, a List
> view and a Repeater view.   For this example, each component could have
> a selectedItem public variable, or use a custom event; that has a
> selectedItem property.  It really doesn't matter, but in this case
> the latter could create less code; especially if you are using
> getter/setters.  So "event.target.selectedOrder" becomes
> "event.selectedOrder."  It's pure preference.  But, you
> simply can't say that one is better than the other, or that tight
> coupling is involved.   It's just not true.
> 
> Like I said earlier, for this I would personally use a presentation
> Model.  

MPO is that views bound to models create too many problems (like itemRenderers 
that can't let go of data so it can be garbage collected, for example).  So the 
vast majority of the time I will set View components' properties directly 
rather than binding.  I think if things are loosely coupled enough, components 
don't know or care whether their data is coming from a Model or Timbuktoo.

> And in an enterprise application that uses an MVC framework,
> custom events with attached data are absolutely necessary to communicate
> across the entire application and with different class types; like
> Views-FrontControllers-Commands or Views-EventMaps-Managers.

That's certainly an interesting opinion, but those terms usually go along with 
Cairngorm, which isn't universally accepted as being loosely coupled 
http://blog.iconara.net/2008/04/13/architectural-atrocities-part-x-cairngorms-model-locator-pattern/
 .

-Amy

Reply via email to