<div dir="ltr">This is an approach that has worked well for me on a couple of projects. <div><span style="line-height:1.5;font-size:13.2px">I think I gave up on fighting rails about where to put the views and the controllers, and had a mix of approaches. I.e. only moving towards this approach for the obvious cases.</span></div><div><span style="font-size:13.2px;line-height:1.5">Where there is a clear grouping of a large enough bunch of related items e.g. DictionaryEntry, DictionaryEntryPresenter, DictionaryEntryCreation, etc. then it makes it easier to navigate and fits in well with the concept of </span><a href="https://www.youtube.com/watch?v=HQXVKHoUQxY">connaissance</a>. </div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">It does lend well to namespacing, which then leads nicely into separating into engines. And in one case, for an unused area of functionality it was a surprising case of </span></div><div><span style="line-height:1.5;font-size:13.2px">rm -rf dictionary_entry specs/dictionary_entry</span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">Run the specs and everything still works. Feature removed! </span><span style="font-size:13.2px;line-height:1.5"><i>(Then just quietly remove the views and controllers/routes afterwards). </i></span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">Didn't have time to look into getting that aspect smoothly done. But I would probably better spend that time looking at <a href="https://github.com/apotonick/trailblazer">trailblazer</a>, which seems to have a lot of great concepts in it.</span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">Along these lines, I quite enjoy the concept of keeping the spec close to the implementation as golang does. I've only gone as far as domain concept based folders in the spec folder as mentioned. I'd be interested to hear if anyone has had success with a directory listing that looks like this:</span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">dictionary_entry.rb</span></div><div><span style="line-height:1.5;font-size:13.2px">dictionary_entry_spec.rb </span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px"><br></span></div><div><span style="line-height:1.5;font-size:13.2px">The only fiddly issue apart from the views/controllers folders was with AR and namespacing based on the domain concept. Which would traditionally be the ActiveRecord model name. </span></div><div><span style="font-size:13.2px;line-height:1.5">E.g. rather than pollute a DictionaryEntry AR model with tons of classes, I ended up namespacing all my AR models as Db::DictionaryEntry etc. </span></div><div><span style="font-size:13.2px;line-height:1.5">Which when you have lots of objects in an app serves a dual purpose of hinting which one is the thing that writes to the db. Probably a double-edged sword, hungarian notation anybody?</span><br></div><div><br></div><div>But equally, on a small app, with a few presenters, a few controllers and non-obvious groupings then it is overkill. It doesn't really cost much more to gradually introduce this kind of structure as appropriate.</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 9, 2015 at 5:59 PM <<a href="mailto:jc@panagile.com">jc@panagile.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><div>Hi Enrico,</div>
<div><br></div>
<div>Thanks for sharing this. It’s an approach that I agree with in general - I’d much rather classes were grouped by domain than by pattern. I have got a couple of questions though:</div>
<div><br></div>
<div>1) Why is it ok to end up with a directories for Controllers, Views and Helpers?</div>
<div><br></div>
<div>2) Sometimes you are creating classes that fulfil specific roles within the framework; e.g, Presenters. How do identify their function when they aren’t grouped in a directory?</div>
<div><br></div>
<div>(Or maybe my assumtion at the start of the second question is wrong, in which case I’d like to hear why.)</div>
<div><br></div>
<div>Thanks,</div>
<div>John</div></span><div><br></div>
<br><br><div class="gmail_quote"><p>On Tue, Sep 8, 2015 at 5:43 PM, Enrico Teotti <span dir="ltr"><<a href="mailto:enrico.teotti@gmail.com" target="_blank">enrico.teotti@gmail.com</a>></span> wrote:<br></p><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>Hi,
<br><br>I wrote a blog post on (Rails) application directories named as
<br>architectural patterns and suggesting a more intention revealing
<br>alternative:
<br><br><a href="http://teotti.com/application-directories-named-as-architectural-patterns-antipattern/" target="_blank">http://teotti.com/application-directories-named-as-architectural-patterns-antipattern/</a>
<br><br>Ciao,
<br><br>Enrico
<br><br>--
<br>[skype] enrico.teotti
<br>[web] <a href="http://teotti.com" target="_blank">http://teotti.com</a>
<br>[twitter] agenteo
<br>_______________________________________________
<br>Chat mailing list
<br><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a>
<br>Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a>
<br>Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a>
<br>List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a>
<br></p></blockquote></div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div>