tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/10839-manual-mediatorsRobotlegs: Discussion 2015-10-19T23:47:58Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/328043102014-05-02T01:00:32Z2015-10-19T23:47:57ZManual Mediators<div><p>Whoops, I guess this should be called "Manual Commanding" not
"Manual Mediation" :P</p></div>mike.canntag:robotlegs.tenderapp.com,2009-10-18:Comment/328043102014-05-03T07:25:46Z2014-05-03T07:25:46ZManual Mediators<div><p>Sorry Michael, I'm on vacation. I've notified Shaun and
creynders about your question. You might get a response from
them.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/328043102014-05-03T09:49:08Z2014-05-03T09:49:08ZManual Mediators<div><p>Hi Michael,</p>
<p>I'd definitely recommend against retrieving the command into the
mediator, since it gives the mediator too much knowledge about the
system. The idea is that a mediator shouldn't know whether its' a
command, service or whatever that responds to its events. This
gives the biggest amount of freedom. Requirements change and maybe
one day something else needs to happen before that command can do
its job, which means that either you'll be rewriting your mediator
to execute multiple commands or you'll let the single command do
more stuff. But if it does more stuff chances are it muddies the
contract the command has fulfilled by implementing a specific
interface.<br>
Another thing, now the command responds in a sync manner, but what
if the new requirement means it needs to do an async operation?<br>
The separation of concerns is not about getting things done now,
but about keeping your code scalable and maintainable. Though I
agree with you it's far easier to have some kind of reqres pattern,
this scales badly and also injects too much low-level detail into
the mediator, whose job is to mediate: translate system data and
events to view data and events and vice versa.</p>
<p>A solution would be to trigger an event from the mediator and
pass some kind of completion event instance as a payload, then the
command does its job and returns the result by triggering the
completion event and passing the results as its payload.</p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/328043102014-05-04T03:02:45Z2015-10-19T23:47:58ZManual Mediators<div><p>Hi Creynders,</p>
<p>Thank you for taking the time to get back to me.</p>
<p>You are probably quite right though passing in a return task
into the Command seems messy.</p>
<p>Ill have a think on this some more.</p>
<p>Cheers,<br>
Mike</p></div>mike.cann