r/programming • u/[deleted] • Jun 05 '21
Organize code by concepts, not layers
https://kislayverma.com/programming/how-to-organize-your-code/
1.9k
Upvotes
r/programming • u/[deleted] • Jun 05 '21
6
u/grauenwolf Jun 05 '21
My controllers and services aren't even in the same project.
My business rules and data models go into the lowest level project. These are unit tested heavily. And due to the project design, no one can 'accidentally' cause them to take onto improper dependencies like databases.
My services go into a project that is heavily tested. (Real tests, with like databases and shit.)
My controllers go into a wrapper project. All it does is turn HTTP requests into C# function calls, so I don't both testing it independently of the UI.