Design and Implement a Progressive Banking System
Model an in-memory banking system whose accounts, money movements, transfers, and transaction history can evolve without rewriting the stable core.
For this exercise, assume you are designing an in-memory banking system that evolves through several requirement stages during a 90-minute OOD and coding session.
The final capability set lets a client open a uniquely identified account with a zero balance, query its balance, deposit and withdraw positive integer-cent amounts, transfer funds between two existing accounts, and request one account's successful transaction history for an inclusive timestamp range in chronological order.
First-seen logical operations arrive with monotonically increasing timestamps; a retry handled by stable request identity is not a new logical operation.
Balances never become negative, a transfer changes both accounts or neither, and every successful money movement appears consistently in each affected account's history without duplicate or partially visible entries.
Unknown accounts, duplicate account IDs, non-positive amounts, insufficient funds, self-transfers, and invalid time ranges return explicit failures without changing balances or history.
Aim for average O(1) account lookup and balance-changing operations; a history query should use an ordered boundary lookup and then process only the K records selected for that account and range, without scanning unrelated accounts or global history. Keep all state in memory.
Authentication, durable persistence, interest, fees, foreign-exchange conversion, external settlement, and user interfaces are outside scope. Design the objects, responsibilities, interfaces, and interactions, then implement the bounded transfer and history-query behavior.
Your design should make later requirements local to the objects or policies that own them rather than forcing a rewrite of the banking core.