CSci 581: Obj.-Oriented Design & Programming
Spring Semester 1999
Lecture Notes


Using CRC Cards: ATM Case Study

These notes are based, in part, on material from chapters 3, 4, 5. and 6 of The CRC Card Book by David Bellin and Susan Suchman Simone (Addison Wesley, 1997). These notes discuss principles and techniques for design using CRC cards using a bank's Automated Teller Machine (ATM) as its example.


Who Writes CRC Cards?


Brainstorming

Groups work by collecting a diverse set of ideas, comparing the ideas, and synthesizing unanticipated solutions.

A "brainstorming" session is a good way to collect the ideas quickly and creatively.

Brainstorming principles [Bellin and Simone]:

  1. All ideas are potentially good ideas.

    Don't censure yourself or others -- all ideas are equal

  2. Think fast and furiously; ponder later.

    A fast-paced discussion encourages individual creativity

  3. Give every voice a turn.

    Include everyone in the group. Don't let the loudmouths dominate.

  4. A little humor can be a powerful force.

    Humor can help break down barriers, relieve tension, and build trust needed for a cohesive and effective group.


Sources for the Candidate Classes

Before the brainstorming session, assign each team member an investigative task [Bellin and Simone]:

A good analyst is a good detective!


Requirements for an Automated Teller Machine (ATM)

University Bank will be opening in Oxford, Mississippi, in January, 2000. We plan to use a full service automated teller machine (ATM) system.

The ATM system will interact with the customer through a display screen, numeric and special input keys, a bankcard reader, a deposit slot, and a receipt printer.

Customers may make deposits, withdrawals, and balance inquires using the ATM machine, but the update to accounts will be handled through an interface to the Accounts system.

Customers will be assigned a Personal Identification Number (PIN) and clearance level by the Security system. The PIN can be verified prior to any transaction.

In the future, we would also like to support routine operations such as a change of address or phone number using the ATM


Brainstorming Steps

  1. Review the brainstorming principles

  2. State session objectives

    Each session should have a precise objective--clear to all and narrow enough to accomplish in the session.

    Avoid digression from the objective.

  3. Use a round-robin technique

    Go around the group from individual to individual.

    Individuals may "pass" if they have nothing to contribute.

    Stop when no one has anything to contribute.

  4. Discuss and select

    Restate the objective, then identify those items that everyone agrees are "winners"

    Then select those items that everyone agrees are "losers"

    Then discuss the items remaining--the "maybes". Set a fixed time limit on discussion. Then, for each item, either decide its status or postpone explicitly until more information is available.


Candidate Classes for the ATM

By brainstorming, we might identify the following candidate classes for University Bank's ATM system [Bellin and Simone]:

ATM FinancialTransaction BankCard
BankCustomer PIN Account
SavingsAccount CheckingAccount Transfer
Withdrawal Deposit BalanceInquiry
Receipt ReceiptPrinter Keypad
Screen CashDispenser ScreenMessage
Display FundsAvailable DepositEnvelopeFailure
Balance TimeOutKey TransactionLog
Key AccountHolder Printer
ScreenSaver Prompt NumericKey


Identifying Core Classes

Moving from brainstorming to analysis, divide the candidate classes into categories in the following order:

  1. critical classes (i.e., the "winners"), for which we will definitely write CRC cards

    Items that directly relate to the main entities of the application

    In the ATM example: Account, Deposit, Withdrawal, BalanceInquiry

  2. irrelevant candidates (i.e., the "losers"), which we will definitely eliminate

    Items that are clearly outside the system scope

    In the ATM example: Printer, ScreenSave, and Prompt -- related to the user interface subsystem to be done later, but not to the core banking application

  3. undecided candidates (i.e., the "maybes"), which we will review further for categorization

    Items that we may not be able to categorize without first clarifying the system boundaries and definition

    In the ATM example: What is an "ATM"?


Clarifying System Scope

To continue design, we must determine what is and what is not part of the system.

What is the scope of the ATM system in the example?
Possible questions:

The system boundary should be the product of definite decision making.

It is often useful to draw a diagram to record system boundaries.

ATM example: limit its scope to the banking information capture -- leaving the user interface and actual account update to other systems


Architectural Design Issues


Eliminate Unnecessary Core Classes


Annotated Candidate Class List for the ATM

Core Classes

FinancialTransaction
Account
BalanceInquiry
Withdrawal
Deposit
AuthorizeSystemInteraction
BankCard

Undecided Classes

BankCustomer (ghost - integrated with AuthorizeSystemInteraction)
PIN (attribute)
SavingsAccount (attribute of Account)
CheckingAccount (attribute of Account)
ATM (ghost -- system name)
FundsAvailable (attribute)
Balance (attribute)
AccountHolder (synonym)

Irrelevant Items

These are outside the scope of the system. Many are candidates for classes in the user interface system.

Transfer (not handled in first version)
Receipt
ReceiptPrinter
Keypad
Screen
CashDispenser
ScreenMessage
Display
DepositEnvelopeFailure
TimeOutKey
TransactionLog
Printer
ScreenSaver
Prompt
Numeric Key
Key


Assigning Responsibilities


Responsibility Detection Pointers

  1. Brainstorm first. Refine later.

    Use brainstorming to identify a set of candidate responsibilities for the core classes. Strive for inclusion of relevant responsibilities rather than exclusion. Don't worry about duplication.

    Later refine the lists of responsibilities. Name each carefully.


  2. Think simple. Factor out complexity.

    If most the responsibilities fall to one or two classes, then the system is probably biased toward a procedural perspective -- does not take advantage of polymorphism and encapsulation. Many of the classes are reduced to "records" -- simply knowing about the information they hold.

    ATM example: A tendency might be to give most of the responsibility to the Account class, which becomes a strong, busy "manager" procedure giving commands to relatively weak, ill-defined "worker" classes. Account is probably too inflexible to be directly reused; the other classes are probably too insignificant to be reused.

    Give each class a distinct role in the system. Strive to make each class a well-defined, complete, cohesive abstraction. Such a class has higher probability of being reused.

    ATM example: Give class Withdrawal the responsibility "Withdraw Funds", making it potentially useful to any other class needing to do a withdrawal. Give class Account the responsibility "Accept Withdrawal", which will, of course, be carried out by collaborating with Withdrawal.

    Factoring out complexity also involves identifying specialized behaviors that occurs repeatedly and, as appropriate, spinning off new classes.

    ATM example: The capturing and responding to user requests might be factored out into a new class Form with a responsibility "ask user for information".


  3. Use abstraction to advantage.

    Build hierarchies of classes. Abstract the essence of related classes by identifying where they have common responsibilities -- where they do the same thing, but do it differently -- same "what", different "how".

    That is, look for opportunities for the classes to use polymorphism to implement the same responsibility differently.

    The new parent classes may be abstract classes. That is, no actual objects may ever exist of that type. The abstract class exists to link together similar concrete types of objects.

    ATM example: Create an abstract class Transaction that is a superclass for Withdrawal, Deposit, etc. It can have an abstract responsibility "execute a financial transaction", that is implemented differently for each subclass.


  4. Do not marry one solution. Play the field first.

    Remember that CRC cards are inexpensive and erasable!!

    Do not hesitate to experiment with different configurations of classes or assignments of responsibilities. Changing the CRC cards is easy in the early stages of a project; changing the code later in the project is not easy.


Assigning Collaborations


Hierarchy Identification Tips


CRC Role Play Steps

  1. Create a list of scenarios for use of the system (i.e., use cases)

    Use brainstorming

    ATM example: customer withdraws cash

  2. Assign the roles of classes to team members

    Each member has one or more classes

  3. Rehearse the scenario

    Execute the scenario with team members announcing what affected classes are doing

  4. Correct CRC card and revise scenario

  5. Repeat above two steps as necessary until rehearsal smooth

  6. Perform final scenario


Developing Role-Play Scenarios


Running an Effective Role Play


Warm-Up Tips


Scenario Enactment


Scenario Assessment


UP to CSCI 581 Lecture Notes root document?


Copyright © 1999, H. Conrad Cunningham
Last modified: Wed Jan 19 04:22:42 CST 2000