AlgoMaster Logo

Design ATM

Ashish

Ashish Pratap Singh

medium

An ATM (Automated Teller Machine) is a self-service banking machine that allows users to perform basic financial transactions such as withdrawing cash and checking account balances using a debit or credit card and a secure PIN, without needing to visit a bank branch.

ATM

They interface with backend banking systems to verify account details, authenticate users, and update balances in real-time.

In this chapter, we will explore the low-level design of ATM in detail.

Lets start by clarifying the requirements:

1. Clarifying Requirements

Before starting the design, it's important to ask thoughtful questions to uncover hidden assumptions, clarify ambiguities, and define the system's scope more precisely.

Here is an example of how a discussion between the candidate and the interviewer might unfold:

After gathering the details, we can summarize the key system requirements.

1.1 Functional Requirements

  • Authenticate users using ATM card and PIN
  • Cash Withdrawal: Dispense requested amount if user has sufficient balance and the ATM has enough cash.
  • Cash Deposit: Allow users to deposit money, which should be immediately reflected in their account balance.
  • Balance Inquiry: Display the current account balance to the user.
  • Maintain internal cash inventory by denomination.
  • Dispense cash using the highest denominations available, whenever possible.
  • Display appropriate messages for insufficient balance or insufficient cash in the ATM.
  • Automatically eject the card after each transaction

1.2 Non-Functional Requirements

  • Modularity: The system should follow object-oriented principles with a clear separation of concerns.
  • Extensibility: The design should be easy to extend to support future enhancements.
  • Maintainability: Code should be well-structured, easy to test, and maintainable.
  • Atomicity: Each transaction must be atomic. For example, a withdrawal involves multiple steps (verify balance, debit account, dispense cash). If any step fails, the entire transaction should be rolled back to ensure consistency.

After the requirements are clear, lets identify the core entities/objects we will have in our system.

2. Identifying Core Entities

Premium Content

This content is for premium members only.