Class Diagram For Example ATM System
Class Diagram For Example ATM System
Shown below is the class diagram for the ATM system. The basic structure of the class diagram arises from the responsibilities and relationships discovered when doing the CRC cards and Interaction Diagrams. (If a class uses another class as a collaborator, or sends a message to an object of that class during an Interaction, then there must either be an association linking objects of those classes, or linking the "sending" class to an object which provides access to an object of the "receiving" class.) In the case of the ATM system, one of the responsibilities of the ATM is to provide access to its component parts for Session and Transaction objects; thus, Session and Transaction have associations to ATM, which in turn has associations to the classes representing the individual component parts. (Explicit "uses" links between Session and Transaction, on the one hand, and the component parts of the ATM, on the other hand, have been omitted from the diagram to avoid making it excessively cluttered.) The need for the various classes in the diagram was discovered at various points in the design process.
Some classes were discovered when doing analysis (see the Analysis Class Diagram developed earlier.) Some classes were discovered when doing CRC cards
o o o o
Message - used to represent a message to the bank. Receipt - used to encapsulate information to be printed on a receipt. Status - used to represent return value from message to the bank. Balances - used to record balance information returned by the bank.
Some classes were discovered when doing detailed design or writing code
o o
Money - used to represent money amounts, in numerous places. AccountInformation - contains names of various types of accounts customer can choose from
That is, OO design is not a "waterfall" process - discoveries made when doing detailed design and coding can impact overall system design. To prevent the diagram from becoming overly large, only the name of each class is shown - the attribute and behavior "compartments" are shown in the detailed design, but are omitted here.
Analysis Classes
An initial reading of the use cases suggests that the following will be part of the system.
A controller object representing the ATM itself (managing the boundary objects listed below.) Boundary objects representing the individual component parts of the ATM:
o o o o o o o
Operator panel. Card reader. Customer console, consisting of a display and keyboard. Network connection to the bank. Cash dispenser. Envelope acceptor. Receipt printer.
Controller objects corresponding to use cases. (Note: class ATM can handle the Startup and Shutdown use cases itself, so these do not give rise to separate objects here.)
o o
Session Transaction (abstract generalization, responsible for common features, with concrete specializations responsible for type-specific portions)
An entity object representing the information encoded on the ATM card inserted by customer. An entity object representing the log of transactions maintained by the machine.
Enter a legitimate System is on amount System output should Perform a demonstrate that a legitimate inquiry connection has been transaction established to the Bank
System Startup
System is shut down System is on and Activate the "off" when the switch is not servicing a System is off switch turned "off" customer Connection to the Bank is terminated when the system is shut down System reads a customer's ATM card System rejects an unreadable card System accepts System has just been shut down System is on and Insert a readable not servicing a card customer System is on and Insert an not servicing a unreadable card customer System is asking Enter a PIN Verify from the bank side that a connection to the ATM no longer exists Card is accepted; System asks for entry of PIN Card is ejected; System displays an error screen; System is ready to start a new session System displays a
Session
Session
Session
Function Being Tested System is started when the switch is turned "on" customer's PIN
Expected Output System requests initial cash amount menu of transaction types
Session
System is System allows displaying menu customer to perform of transaction a transaction types
Perform a transaction
System asks whether customer wants another transaction System displays a menu of transaction types System ejects card and is ready to start a new session
Session
System is asking System allows whether customer multiple transactions Answer yes wants another in one session transaction Session ends when customer chooses not to do another transaction System is asking whether customer Answer no wants another transaction
Session
Individual types of Transaction transaction will be tested below Transaction System handles an A readable card invalid PIN properly has been entered Enter an incorrect The Invalid PIN PIN and then Extension is attempt a performed transaction System displays a menu of account types System displays a menu of possible withdrawal amounts
System asks Menu of account customer to choose a Choose checking Withdrawal types is being dollar amount to account displayed withdraw System is System performs a displaying the legitimate Withdrawal menu of withdrawal withdrawal transaction properly amounts
System dispenses this Choose an amount amount of cash; that the system System prints a currently has and correct receipt which is not showing amount and greater than the correct updated account balance balance; System records
Function Being Tested System is started when the switch is turned "on"
Expected Output System requests initial cash amount transaction correctly in the log (showing both message to the bank and approval back)
System has been started up with less than the maximum System verifies that withdrawal it has sufficient cash Withdrawal amount in cash on on hand to fulfill the hand; request System is requesting a withdrawal amount System verifies that customer's balance is Withdrawal sufficient to fulfill the request System is requesting a withdrawal ammount
System displays an Choose an amount appropriate message greater than what and asks customer to the system choose a different currently has amount
Choose an amount that the system currently has but which is greater than the account balance
System displays an appropriate message and offers customer the option of choosing to do another transaction or not.
A withdrawal transaction can be System is cancelled by the Withdrawal displaying menu customer any time of account types prior to choosing the dollar amount
System displays an appropriate message and offers customer Press "Cancel" key the option of choosing to do another transaction or not. System displays an appropriate message and offers customer the option of choosing to do another transaction or not. System displays a
A withdrawal transaction can be System is cancelled by the Withdrawal displaying menu Press "Cancel" key customer any time of dollar amounts prior to choosing the dollar amount Deposit System asks Menu of Choose Deposit
Function Being Tested System is started when the switch is turned "on"
Expected Output System requests initial cash amount menu of account types System displays a request for the customer to type a dollar amount
customer to choose transaction types transaction an account to deposit is being displayed to Deposit System asks customer to enter a dollar amount to deposit Menu of account Choose checking types is being account displayed
Deposit
System is System asks displaying a customer to insert an request for the envelope customer to type a dollar amount
System requests that Enter a legitimate customer insert an dollar amount envelope System accepts envelope; System prints a correct receipt showing amount and correct updated balance; Insert an envelope System records transaction correctly in the log (showing message to the bank, approval back, and acceptance of the envelope) System displays an appropriate message and offers customer Press "Cancel" key the option of choosing to do another transaction or not.
Deposit
System is System performs a requesting that legitimate deposit customer insert transaction properly an envelope
Deposit
A deposit transaction can be cancelled by System is the customer any displaying menu time prior to of account types inserting an envelope A deposit transaction can be cancelled by the customer any time prior to inserting an envelope
Deposit
System displays an System is appropriate message requesting Press "Cancel" key and offers customer customer to enter the option of a dollar amount choosing to do
Function Being Tested System is started when the switch is turned "on"
Expected Output System requests initial cash amount another transaction or not.
Deposit
A deposit transaction can be cancelled by the customer any time prior to inserting an envelope A deposit transaction is cancelled automatically if an envelope is not inserted within a reasonable time System asks customer to choose an account to transfer from System asks customer to choose an account to transfer to System asks customer to enter a dollar amount to transfer
System displays an appropriate message System is and offers customer requesting Press "Cancel" key the option of customer to insert choosing to do an envelope another transaction or not. System displays an appropriate message System is and offers customer requesting Wait for the the option of customer to insert request to time out choosing to do an envelope another transaction or not. Menu of Choose Transfer transaction types transaction is being displayed Menu of account types to transfer Choose checking from is being account displayed Menu of account types to transfer Choose savings to is being account displayed System displays a menu of account types specifying transfer from System displays a menu of account types specifying transfer to System displays a request for the customer to type a dollar amount
Deposit
Transfer
Transfer
Transfer
Transfer
System is System performs a displaying a legitimate transfer request for the transaction properly customer to type a dollar amount
System prints a correct receipt showing amount and correct updated Enter a legitimate balance; dollar amount System records transaction correctly in the log (showing both message to the bank and approval
Function Being Tested System is started when the switch is turned "on"
Transfer
A transfer transaction can be cancelled by the customer any time prior to entering dollar amount A transfer transaction can be cancelled by the customer any time prior to entering dollar amount A transfer transaction can be cancelled by the customer any time prior to entering dollar amount
System displays an appropriate message and offers customer Press "Cancel" key the option of choosing to do another transaction or not. System displays an appropriate message and offers customer Press "Cancel" key the option of choosing to do another transaction or not.
Transfer
Transfer
System displays an appropriate message System is and offers customer requesting Press "Cancel" key the option of customer to enter choosing to do a dollar amount another transaction or not. System displays a menu of account types System prints a correct receipt showing correct balance; System records transaction correctly in the log (showing both message to the bank and approval back) System displays an appropriate message
Inquiry
System asks Menu of customer to choose Choose Inquiry transaction types an account to inquire transaction is being displayed about
Inquiry
System performs a System is legitimate inquiry displaying menu transaction properly of account types
Inquiry
Function Being Tested System is started when the switch is turned "on"
Expected Output System requests initial cash amount and offers customer the option of choosing to do another transaction or not.
cancelled by the of account types customer any time prior to choosing an account
Enter an incorrect PIN; Attempt an inquiry Customer is asked to transaction on the re-enter PIN customer's checking account Request to reenter PIN is being Enter correct PIN displayed An incorrect PIN has been reentered and Perform another transaction transaction completed normally Original transaction completes successfully This transaction completes successfully as well An appropriate message is displayed and re-entry of the PIN is again requested
Invalid PIN Correct re-entry of Extension PIN is accepted A correctly reInvalid PIN entered PIN is used Extension for subsequent transactions
Request to reInvalid PIN Incorrect re-entry of Enter incorrect enter PIN is being Extension PIN is not accepted PIN displayed Correct re-entry of Invalid PIN PIN on the second Extension try is accepted Correct re-entry of Invalid PIN PIN on the third try Extension is accepted
Enter incorrect Request to reOriginal transaction PIN the first time, enter PIN is being completes then correct PIN displayed successfully the second time Enter incorrect Request to rePIN the first time Original transaction enter PIN is being and second times, completes displayed then correct PIN successfully the third time An appropriate message is displayed; Card is retained by machine;
Three incorrect reRequest to reInvalid PIN entries of PIN result Enter incorrect enter PIN is being Extension in retaining card and PIN three times displayed aborting transaction
Function Being Tested System is started when the switch is turned "on"
The object representing the machine itself (responsible for the System Startup and Shutdown use cases) Objects representing a customer session (one per session) (responsible for the Session use case) Objects representing an individual transaction (one per transaction) (responsible for the Transaction use case, use cases for the specific types of transaction, and Invalid PIN extension).
[ CRC Card for ATM ] [ Interaction diagram for Startup ] [ Interaction diagram for Shutdown ]
Sequence Diagram for System Startup Use Case Sequence Diagram for System Shutdown Use Case Sequence Diagram for Session Use Case Sequence Diagram for Transaction Use Case (Since transaction is abstract, this gives the overall flow of a transaction. See the interactions below for specific concrete cases.) Collaboration realizing specifics of Withdrawal Transaction Use Case Collaboration realizing specifics of Deposit Transaction Use Case Collaboration realizing specifics of Transfer Transaction Use Case Collaboration realizing specifics of Inquiry Transaction Use Case Collaboration realizing Invalid PIN Extension