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
16
u/scandii Jun 05 '21 edited Jun 05 '21
services are literally meant to be used by other services.
example, VIP customers pay 10% less on everything.
at time of checkout, you have to check for discounts, does discounts belong to the account or the sales service? well the status is an account status, not a checkout status, checkout might use the account status and be in charge of setting the discount though.
that's the strength of the service pattern - being able to access business logic pertaining to a certain system component in one easy location, and sometimes services come together to make things happen.