<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 30 April 2014 15:12, Stephen Henderson <span dir="ltr"><<a href="mailto:stephen@cognitivematch.com" target="_blank">stephen@cognitivematch.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>DHH has done a blog post which explains a bit better his argument that TDD/DI can make code worse: <a href="http://david.heinemeierhansson.com/2014/test-induced-design-damage.html" target="_blank">http://david.heinemeierhansson.com/2014/test-induced-design-damage.html</a></div>


<div><br>
</div>
<div>It makes a lot more sense now and it’s a very rails-specific argument. The gist of it is:</div>
<ul>
<li>The ports-and-adapters model of decoupling business logic from frameworks doesn’t work well with Rails controllers. </li><li>It requires too many extra objects and classes which end up obscuring the original intent, e.g.turning a 5 line controller method into a handful of business objects and callbacks.</li>

<li>There’s little point in trying to unit test controllers directly. You should only test controllers at integration level and above.</li></ul>
<div>I can see where he’s coming from and I sort-of agree to a point. It’s definitely worth watching the Jim Weirich presentation he talks about to put it in context (<a href="https://www.youtube.com/watch?v=tg5RFeSfBM4" target="_blank">https://www.youtube.com/watch?v=tg5RFeSfBM4</a>). </div>


<div><br>
</div>
<div>The tight coupling of framework with business logic and persistence is arguably a big reason why people like Rails. If you completely decouple your business logic from the framework are you losing a lot of what makes Rails so attractive? Personally I’m
 not a massive fan of Rails because of tight coupling so I’m probably not a good person to answer that, but it’s an interesting question. I think some of it is definitely linked to the scale of the application in question, but that’s a general Rails problem
 too :-/</div></blockquote></div><br>If you haven't already, I'd also recommend reading <a href="http://en.wikipedia.org/wiki/Robert_Cecil_Martin">Bob Martin</a>'s response to the DHH blog post: <a href="http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html">http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html</a></div>

</div>