tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/968-passing-mutable-objects-through-eventsRobotlegs: Discussion 2012-07-22T15:40:03Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/174981422012-07-22T13:35:48Z2012-07-22T13:35:48ZPassing mutable objects through events<div><p>Hey Markus,</p>
<p>I'm very glad to hear you're enjoying the framework!</p>
<p>Regarding your question, I agree that in theory, values passed
to the<br>
view should be immutable as far as the model is concerned.</p>
<p>I also think, however, that in most cases you shouldn't
bother,<br>
really. While passing read-only structures or deep copies around
will<br>
prevent lazy people (like Future You) from taking shortcuts,
they're<br>
pretty likely to find ways around that anyway, if they really try.
If<br>
you pass copies around, for example, they might change the data<br>
nevertheless, because the effect will be seen in a view that
handles<br>
the data after where they're currently handled.</p>
<p>What I mean is that even in large systems, you should use a
mixture of<br>
technical enforcement and conventions to get to a clean system.</p>
<p>If, however, your views are not to be trusted for some
reason<br>
(remember that pest of a coworker who's working on them, Future
You: he is so goddamn prone to take the most awful shortcuts!),
then you<br>
should take technical precautions to whatever degree seems sensible
to<br>
you.</p>
<p>Luckily, some of the worst shortcuts you ever encountered where
taken<br>
by that other guy, Past You, and he doesn't work on the project<br>
anymore.</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/174981422012-07-22T15:12:09Z2012-07-22T15:12:09ZPassing mutable objects through events<div><p>Haha, thanks for the great answer! I'm really happy, that after
encountering another, random problem in fabrication, I decided to
rather switch framework then fix it again.</p></div>Markustag:robotlegs.tenderapp.com,2009-10-18:Comment/174981422012-07-22T15:40:02Z2012-07-22T15:40:02ZPassing mutable objects through events<div><p>Glad to be of help :)</p></div>Till Schneidereit