tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/624-composite-mediators-bad-practiceRobotlegs: Discussion 2018-10-18T16:35:30Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/90463642011-08-03T09:44:48Z2011-08-03T09:44:48ZComposite mediators (bad practice?)<div><p>Hi Xantrus,</p>
<p>I think you're almost there with this - if you add some
interfaces to your composite views then you can use a factory to
automatically determine which mediators to create for this view.
This is called "covariant mediation" - guyinthechair recently made
a utility for it - which you can find here:</p>
<p><a href=
"https://github.com/dnalot/robotlegs-utilities-variance">https://github.com/dnalot/robotlegs-utilities-variance</a></p>
<p>I haven't tried the util, but it might give you some clues as to
the best approach, or you might be able to use his util
directly.</p>
<p>And, as you say, changing the mediator when the view changes is
hard to avoid. I'd say some view-mediator coupling is unavoidable -
the key thing is to keep it to the api and events domain.</p>
<p>hth</p>
<p>Stray</p></div>Stray