<div dir="ltr"><i>> <span style="font-family:arial,sans-serif;font-size:13px">Using modules to mix in behaviour is the same as inheritance and the composition over inheritance argument has already been had.</span></i><div>
<i><span style="font-family:arial,sans-serif;font-size:13px"><br></span></i></div><div><font face="arial, sans-serif">I don't think I'm quite clever enough to follow the whole service objects vs. modules vs. objects vs. dependency injection debate, but this line in particular weakens your argument a little.</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">The composition over inheritance argument has indeed already been had: the primary reason that composition is better than inheritance is that inheritance needlessly couples type to implementation. Mixing in a module doesn't do that. There are other problems with modules (in particular when you have a lot of them, implicit dependencies can creep in between them) but "they are the same as inheritance therefore bad" strikes me as a little lazy.</font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 2:15 PM, Stephen Best <span dir="ltr"><<a href="mailto:bestie@gmail.com" target="_blank">bestie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">@Riccardo Using decorators over extend gives you<div><br></div><div>* No method / instance variable naming collisions (counts for private methods too)</div>
<div>* Separate state</div><div>* Very obvious which decorations have been applied</div>

<div>* You can unwrap the decorators and get the original object back</div><div><br></div><div>The annoying this really is that the difference in effort is negligible yet the module approach is widely cargo-culted.<br><div>


<div><br></div><div>Using modules to mix in behaviour is the same as inheritance and the composition over inheritance argument has already been had.</div><div><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On 4 March 2014 10:24, Riccardo Tacconi <span dir="ltr"><<a href="mailto:rtacconi@gmail.com" target="_blank">rtacconi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">I created this project (very incomplete) to try few things and one was DCI: <a href="https://github.com/rtacconi/scriptrunner/blob/master/app/contexts/runner_on_project.rb" target="_blank">https://github.com/rtacconi/scriptrunner/blob/master/app/contexts/runner_on_project.rb</a>. Yes I used 'extend' but it is 'expensive' and using mixins seems okay to me. What's the advantage of using decorators?</div>


<div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 4 March 2014 09:37, Stephen Best <span dir="ltr"><<a href="mailto:bestie@gmail.com" target="_blank">bestie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div dir="ltr">Also why do Ruby developers insist on implementing DCI by mixing in modules at runtime? It's just completely unnecessary, why not decorate?<div><div class="gmail_extra"><div><br clear="all"><div>
<div dir="ltr">

<br>Stephen Best<br><br><a href="tel:%2B44%207745%20790523" value="+447745790523" target="_blank">+44 7745 790523</a><br><div><a href="http://theaudaciouscodeexpiment.com" target="_blank">theaudaciouscodeexpiment.com</a><br>



<a href="http://github.com/bestie" target="_blank">github.com/bestie</a><br>

@thebestie</div></div></div>
<br><br></div><div><div><div class="gmail_quote">On 4 March 2014 09:35, Stephen Best <span dir="ltr"><<a href="mailto:bestie@gmail.com" target="_blank">bestie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div dir="ltr">DHH as usual saying the best way to design your objects is don't. GOOD LUCK WITH THAT.<br><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><br>Stephen Best<br><br><a href="tel:%2B44%207745%20790523" value="+447745790523" target="_blank">+44 7745 790523</a><br>





<div><a href="http://theaudaciouscodeexpiment.com" target="_blank">theaudaciouscodeexpiment.com</a><br>
<a href="http://github.com/bestie" target="_blank">github.com/bestie</a><br>@thebestie</div></div></div><div><div>
<br><br><div class="gmail_quote">On 3 March 2014 23:09, Mark Burns <span dir="ltr"><<a href="mailto:markthedeveloper@gmail.com" target="_blank">markthedeveloper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div dir="ltr">It's kind of similar, but DCI is kind of like a run-time only ActiveSupport::Concern.<div>It's still a big bag o' methods, but a big dynamic bag of methods. Maybe less chance of collisions, but</div>








<div>the principle is still the same as AS::Concern.</div><div>Interactors in the sense of the interactor gem are cleaner as you're not polluting a potentially already</div><div>overloaded domain model/persistence object hybrid.</div>







</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 3 March 2014 22:18, Riccardo Tacconi <span dir="ltr"><<a href="mailto:rtacconi@gmail.com" target="_blank">rtacconi@gmail.com</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Tom,<div><br></div><div>Your interactor reminds me the I part (interaction) of DCI, am I wrong? I see few similarities.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>
On 3 March 2014 20:38, Tom Blomfield <span dir="ltr"><<a href="mailto:tomblomfield@gmail.com" target="_blank">tomblomfield@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi all,<div><br></div><div>I wrote a blog post on Interactors in Rails - <a href="http://eng.joingrouper.com/blog/2014/03/03/rails-the-missing-parts-interactors" target="_blank">http://eng.joingrouper.com/blog/2014/03/03/rails-the-missing-parts-interactors</a></div>









<div><br></div><div>You might enjoy the discussion on HN, with DHH wading in <a href="https://news.ycombinator.com/item?id=7335211" target="_blank">https://news.ycombinator.com/item?id=7335211</a></div><span><font color="#888888"><div>








<br></div><div>Tom</div></font></span></div>
<br></div></div><div>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></div></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Riccardo Tacconi<br>Ruby on Rails and PHP development - System Administration<br><a href="http://www.virtuelogic.net/" target="_blank">VIRTUELOGIC LIMITED</a><br>








<br><a href="http://github.com/rtacconi" target="_blank">http://github.com/rtacconi</a><br><a href="http://riccardotacconi.blogspot.com" target="_blank">http://riccardotacconi.blogspot.com</a><br><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a>
</font></span></div>
<br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Riccardo Tacconi<br>Ruby on Rails and PHP development - System Administration<br><a href="http://www.virtuelogic.net/" target="_blank">VIRTUELOGIC LIMITED</a><br>



<br><a href="http://github.com/rtacconi" target="_blank">http://github.com/rtacconi</a><br><a href="http://riccardotacconi.blogspot.com" target="_blank">http://riccardotacconi.blogspot.com</a><br><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a>
</div>
</div></div></blockquote></div><br></div></div></div></div></div></div>
<br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br></div>