Separation of concerns, please.

One of the key responsibilities of my job at a cryptocurrency exchange is the ability to write code that can debit and credit fiat and crypto assets on orders and transfers. Apparently, when I was new, I developed code that was overly repetitious, and debit and credit were handled by making direct calls to the balance repository, and each module had its own version of debit and credit since items were added one after the other. It was difficult and a pain to troubleshoot until I realised I should have developed a separate module only for the balances. For all balance modifications, all modules now make a call to the "balances" module, and there is an audit entry for each update.

It made my life so much easier. So yes, keep it simple and maintain separation of concerns.


Trust me it saves you a lot of production bugs and nightmares also helps you with faster tests.