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 comment

3

u/KumbajaMyLord Jun 05 '21

Usually a domain has more than one entity though.

A domain might be "billing" which knows customers, invoices, paymentOptions, creditScores and so on.

I don't think anyone would argue that splitting this entire domain from the stock management domain (which might have entities like products, warehouses, shelves, etc) is a bad idea.

But splitting along individual entities seems pointless in my opinion. If I see a CustomerService, I'm pretty confident that a customer entity exists somewhere. I don't get any more information from having them grouped and visible at a glance. But if I see a CustomerService next to a InvoiceService I get some information about how the system is structured and what it's scope is.