The “Code Organization Problem”

Recently someone asked me how I organize my Rails apps. That question came unexpectedly, and I probably did a poor job explaining what I do – this is essentially something that can span multiple hours of discussion, and probably will bring lots of disagreements. So I decided to make a post, and hopefully this might help other people (and to be fair, this is not only valid for Ruby but for any language, really).

First things first, if you I am working in a project with multiple people, I will try to keep the project’s defaults; if the project already have specific organizations (like “app/services” or “app/presenters”) I will follow them; Rails is probably one of the best experiences I have ever seen in collaborating with other teams, and eroding this might bring down the biggest benefit of the framework. But considering I don’t have an already existing structure, or if I need to create some new ones, I will try to bring some personal rules:
(more…)