This question evaluates understanding of stateful component design, transactional integrity, concurrency control, data modeling for transaction histories, and edge-case handling in a financial context.
Design a Transaction/Account component that supports deposits and withdrawals.
Assume you are building a backend library or service used by other parts of a financial application.
deposit(amount)
withdraw(amount)
getBalance()
Explain your design choices, data structures, and how you would test it.