<div dir="ltr">I don't use HN enough to remember my login so afraid I can't comment there.<div><br></div><div>Some people like to fallback to DHH's advice whenever someone suggests the non-rails way inside of rails. Arguments like "you might as well not use rails" and "reimplementing Java in Ruby" aren't really helpful and miss some of the simple benefits a better design can have.</div>
<div><br></div><div>Here on this list just the other day someone complained about slow tests and everyone suggested starting with rails. That's a huge code smell to me.</div><div><br></div><div>Your advice regarding "domain objects have no knowledge of persistence" is a great one for speeding up tests. I would even suggest you go further and write your domain logic in a rails-less environment. Not just because it's "good design" but because you don't want to be booting rails when you should be focusing on the domain.</div>
<div><br></div><div>Of course you will want to test your queries against a DB but that's the persistence layer and is a small subsection of your entire application and that arguably still doesn't need rails booted!</div>
<div><br></div><div>Also another side effect of not requiring rails in your tests is that you get tidier tests. It's much easier to mock out dependency injected logic rather than just assuming the object exists in rails application time and then monkey patching unrelated objects at test time with spies.</div>
<div><br></div><div>Good design isn't just for the sake of it. If you are doing TDD it is a cheap way of getting fast and easy to read tests.</div><div><br></div><div>Luke</div><div class="gmail_extra"><br><div class="gmail_quote">
On 18 March 2014 11:15, 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"><div>I have a blog post that is currently enjoying a fleeting moment of exposure via a questionable "news" for "hackers" outlet. Would love to hear LRUG's feedback.</div><div><br></div>
<a href="https://news.ycombinator.com/item?id=7421018" target="_blank">https://news.ycombinator.com/item?id=7421018</a><br clear="all"><div><div dir="ltr"><br><br></div><div dir="ltr">Stephen Best<br><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>
<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></div>