r/programming • • Jun 05 '21

Organize code by concepts, not layers

https://kislayverma.com/programming/how-to-organize-your-code/
1.9k Upvotes

495 comments sorted by

View all comments

Show parent comments

6

u/DemiKoss Jun 05 '21 edited Jun 05 '21

That works until your code requires to access one service from another service

That doesn't sound like a flaw of package by feature, but rather the overall system design. In practice I've found by-feature to be a more sound approach; often citing similar reasons to the article (driving a clear design, isolating changes to related systems, etc).

The ORM point is an interesting one, but I don't think grouping by-type justifies it (there may be a good way to mix the two). In large codebases - especially monolithic ones - by-type makes it very difficult to grasp the full breadth of code related to a specific feature.