Automated Teller Machines (ATMs) are essential part of any banking system. ATMs are used to perform various transactions and account related functionalities at bank. The ATM system can be represented as object-oriented model to show the flow of data within the system, such as following.
We have Bank, ATM, Debit Card, Customer, Account, ATM Transaction, Saving Account, Checking Account, Withdrawal Transaction and Transfer Transaction classes in the system.
Although there can be more classes and this whole system can be a lot bigger than what it looks like, we are limiting the scope for the sake of this discussion.
Each class in this diagram is very much self-explanatory. Bank class is the information about banks and various metadata about it.
Customer class keep information about customer, customer can have Account which can be either Checking or Savings. Customer can make transactions which can be Either Withdrawal Transaction or Transfer Transaction using Debit Card.
The use-cases of ATM Machine can be described in the following diagram, which helps identify and clarifying user-interactions with ATM.
This use-case diagram shows customer interaction with bank using ATM machine. Customer can login to ATM using Debit Card, logout, check balance, print transaction receipt and deposit checks etc. All these activities ultimately tied to his or her bank account. These interactions between customer and bank can be translated into sequence diagram such as following.
The above sequence diagram shows the sequence of interaction between customer and bank in the context of timing of these events in sequential way one after another.
This show what sequence of events happens when customer interact with ATM and make transactions. Another comprehensive way to show these interactions is finite-state machine diagram, such as following.
This finite state machine diagram roughly shows the same behavior as sequence diagram but little more elaborated ways that customer is going to use and see various situation based on usage.
The state-machine represents the scenarios how user is going to use in real-world. When user comes to ATM, and insert Debit Card, ATM asks for PIN number. User enters PIN, in case of wrong PIN, ATM shows error message and asks again. There are only few failed attempts allowed to prevent fraud, if user fails on all attempts card is locked by ATM.
If user enters correct PIN, ATM show screen for making transactions, and various other options such as print receipt etc. When user enter transaction amount more than availed balance he or she sees appropriate error message. Once user is done with transactions, he or she can end the session, and terminate the session.