Detailed Design

A major task of detailed design is to spell out, in detail, the attributes and methods needed by each class (the second and third "compartments" of the representation for each class in a class diagram.)

The methods needed by each class are implicit in the responsibilities assigned to the class in the CRC cards, and become explicit in the Interaction Diagrams. A responsibility listed for a class on its CRC card generally maps into a method or methods in the detailed design. Likewise, any time an object belonging to a given class is shown as the recipient of a message in either a Sequence or Collaboration Diagram, the class needs a corresponding method. Many of the needed attributes are also either explicitly or implicitly present in the diagrams; the need for others becomes evident as the code for the class is being written. (Thus detailed design and coding are a "round trip" process - detailed design dictates coding, and coding leads to elaboration of the detailed design.)

In designing this system, a few key design decisions were made:

In the design below, each class is developed in isolation. No attempt is made to connect each class to related classes as in the class diagram, because the resulting picture would not fit on a displayable web page. Therefore, this detailed design should be viewed in conjunction with the Class Diagram developed earlier.

 
 

ATM

- id: int
- place: String
- bankName: String
- bankAddress: InetAddress
- cardReader: CardReader
- cashDispenser: CashDispenser
- customerConsole: CustomerConsole
- envelopeAcceptor: EnvelopeAcceptor
- log: Log
- networkToBank: NetworkToBank
- operatorPanel: OperatorPanel
- receiptPrinter: ReceiptPrinter
- state: int
- switchOn: boolean
- cardInserted: boolean
- OFF_STATE: final int
- IDLE_STATE: final int
- SERVING_CUSTOMER_STATE: final int

+ ATM(id: int, place: String, bankName: String, bankAddress: InetAddress)
+ run()
+ switchOn()
+ switchOff
+ cardInserted()
+ getID(): int
+ getPlace(): String
+ getBankName(): String
+ getCardReader(): CardReader
+ getCashDispenser(): CashDispenser
+ getCustomerConsole(): CustomerConsole
+ getEnvelopeAcceptor(): EnvelopeAcceptor
+ getLog(): Log
+ getNetworkToBank(): NetworkToBank
+ getOperatorPanel(): OperatorPanel
+ getReceiptPrinter(): ReceiptPrinter
- performStartup()
- performShutdown()

[ Links for this class ]

 
 

CardReader

- atm: ATM

+ CardReader(atm: ATM)
+ readCard(): Card
+ ejectCard()
+ retainCard()

[ Links for this class ]

 
 

CashDispenser

- log: Log
- cashOnHand: Money

+ CashDispenser(log: Log)
+ setInitialCash(initialCash: Money)
+ checkCashOnHand(amount: Money): boolean
+ dispenseCash(amount: Money)

[ Links for this class ]

 
 

CustomerConsole


+ CustomerConsole()
+ display(message: String)
+ readPIN(prompt: String): int throws Cancelled
+ readMenuChoice(prompt: String, menu: String []): int throws Cancelled
+ readAmount(prompt: String): Money throws Cancelled

[ Links for this class ]

 
 

EnvelopeAcceptor

- log: Log

+ EnvelopeAcceptor(log: Log)
+ acceptEnvelope() throws Cancelled

[ Links for this class ]

 
 

Log


+ Log()
+ logSend(message: Message)
+ logResponse(status: Status)
+ logCashDispensed(amount: Money)
+ logEnvelopeAccepted()

[ Links for this class ]

 
 

NetworkToBank

- log: Log
- bankAddress: InetAddress

+ NetworkToBank(log: Log, bankAddress: InetAddress)
+ openConnection()
+ closeConnection()
+ sendMessage(message: Message, out balances: Balances): Status

[ Links for this class ]

 
 

OperatorPanel

- atm: ATM

+ OperatorPanel(atm: ATM)
+ getInitialCash(): Money

[ Links for this class ]

 
 

ReceiptPrinter


+ ReceiptPrinter()
+ printReceipt(receipt: Receipt)

[ Links for this class ]

 
 

Session

- atm: ATM
- pin: int
- state: int
- READING_CARD_STATE: final int
- READING_PIN_STATE: final int
- CHOOSING_TRANSACTION_STATE: final int
- PERFORMING_TRANSACTION_STATE: final int
- EJECTING_CARD_STATE: final int
- FINAL_STATE: final int

+ Session(atm: ATM)>
+ performSession()
+ setPIN(int pin)

[ Links for this class ]

 
 

Transaction

# atm: ATM
# session: Session
# card: Card
# pin: int
# serialNumber: int
# message: Message
# balances: Balances
- TRANSACTION_TYPES_MENU: final String []
- nextSerialNumber: int
- state: int
- GETTING_SPECIFICS_STATE: final int
- SENDING_TO_BANK_STATE: final int
- INVALID_PIN_STATE: final int
- COMPLETING_TRANSACTION_STATE: final int
- PRINTING_RECEIPT_STATE: final int
- ASKING_DO_ANOTHER_STATE: final int

# Transaction(atm: ATM, session: Session, card: Card, pin: int)
+ makeTransaction(atm: ATM, session: Session, card: Card, pin: int): Transaction throws Cancelled
+ performTransaction(): boolean throws CardRetained
+ performInvalidPinExtension(): Status throws Cancelled, CardRetained
+ getSerialNumber(): int
# getSpecificsFromCustomer(): Message throws Cancelled
# completeTransaction(): Receipt throws Cancelled

[ Links for this class ]

 
 

Withdrawal

- from: int
- amount: Money

+ Withdrawal(atm: ATM, session: Session, card: Card, pin: int)
# getSpecificsFromCustomer(): Message throws Cancelled
# completeTransaction(): Receipt

[ Links for this class ]

 
 

Deposit

- to: int
- amount: Money

+ Deposit(atm: ATM, session: Session, card: Card, pin: int)
# getSpecificsFromCustomer(): Message throws Cancelled
# completeTransaction(): Receipt throws Cancelled

[ Links for this class ]

 
 

Transfer

- from: int
- to: int
- amount: Money

+ Transfer(atm: ATM, session: Session, card: Card, pin: int)
# getSpecificsFromCustomer(): Message throws Cancelled
# completeTransaction(): Receipt

[ Links for this class ]

 
 

Inquiry

- from: int

+ Inquiry(atm: ATM, session: Session, card: Card, pin: int)
# getSpecificsFromCustomer(): Message throws Cancelled
# completeTransaction(): Receipt

[ Links for this class ]

 
 

AccountInformation

+ ACCOUNT_NAMES: final String[]
+ ACCOUNT_ABBREVIATIONS: final String []

[ Links for this class ]

 
 

Balances

- total: Money
- available: Money

+ Balances()
+ setBalances(total: Money, available: Money)
+ getTotal(): Money
+ getAvailable(): Money

[ Links for this class ]

 
 

Card

- number: int

+ Card(number: int)
+ getNumber(): int

[ Links for this class ]

 
 

Message

+ WITHDRAWAL: final int
+ INITIATE_DEPOSIT: final int
+ COMPLETE_DEPOSIT: final int
+ TRANSFER: final int
+ INQUIRY: final int
- messageCode: int
- card: Card
- pin: int
- serialNumber: int
- fromAccount: int
- toAccount: int
- amount: int

+ Message(messageCode: int, cardNumber: Card, pin: int, serialNumber: int, fromAccount: int, toAccount: int, amount: Money)
+ toString(): String
+ setPIN(pin: int)
+ getMessageCode(): int
+ getCard(): Card
+ getPIN(): int
+ getSerialNumber(): int
+ getFromAccount(): int
+ getToAccount(): int
+ getAmount(): Money

[ Links for this class ]

 
 

Money

- cents: long

+ Money(dollars: int)
+ Money(dollars: int, cents: int)
+ Money(toCopy: Money)
+ toString(): String
+ add(amountToAdd: Money)
+ subtract(amountToSubtract: Money)
+ lessEqual(compareTo: Money): boolean

[ Links for this class ]

 
 

Receipt

- headingPortion: String []
# detailsPortion(): String []
- balancesPortion: String []

# Receipt(atm: ATM, card: Card, transaction: Transaction, balances: Balances)
+ getLines(): Enumeration

[ Links for this class ]

 
 

Status


+ toString(): String
+ isSuccess(): boolean
+ isInvalidPIN(): boolean
+ getMessage(): String

[ Links for this class ]

 
 


Page of links for non frames-enabled browsers.

Valid XHTML 1.0!

Copyright © 2000, 2001, 2002 - Russell C. Bjork. Permission for non-commercial reproduction for educational use is hereby granted; all other rights are reserved.