CSC/ECE 517 Fall 2007/wiki2 5 kq: Difference between revisions
Line 23: | Line 23: | ||
=Best Page Related to CRC= | =Best Page Related to CRC= | ||
[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html CRC Cards for ATM Example] is a very good page for a CRC card instantiation. We have browsed through hundreds of websites regarding to CRC card, and this page offers a clearest and most complete example using CRC card and Java implementation. | |||
The example the page provides is how to design an [http://en.wikipedia.org/wiki/Automated_teller_machine ATM machine]. It is absolutely not an easy task since an ATM machine has to interact with the bank and the user, and a transaction is also related to reading card and printing receipt. Moreover, the login system is essential to ensure security. In order to deal with the relationship of so many distinct classes of objects, we need the help of CRC card. | |||
The description on the CRC card of each class makes it clear of the responsibility and collaborate class of the specific class, and facilitate the designer to design interfaces more easily. | |||
Below is a complete list of the class used in an ATM machine design. | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#ATM Class ATM] | |||
Boundary/entity objects - component parts of the ATM | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#CardReader Class CardReader] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#CashDispenser Class CashDispenser] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#CustomerConsole Class CustomerConsole] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#EnvelopeAcceptor Class EnvelopeAcceptor] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Log Class Log] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#NetworkToBank Class NetworkToBank] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#OperatorPanel Class OperatorPanel] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#ReceiptPrinter Class ReceiptPrinter] | |||
Controller objects corresponding to the various use cases | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Session Class Session] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Transaction Class Transaction] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Withdrawal Class Withdrawal] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Deposit Class Deposit] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Transfer Class Transfer] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Inquiry Class Inquiry] | |||
Entity objects found necessary when assigning responsiblities to other objects | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Balances Class Balances] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Card Class Card] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Message Class Message] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Receipt Class Receipt] | |||
#[http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html#Status Class Status] | |||
=Examples of CRC= | =Examples of CRC= |
Revision as of 20:24, 24 October 2007
This Wiki Page is edited by Kunta Tsai and Qinyi Ding
Topic
CRC cards. Hundreds of Web pages cover CRC cards. Which explain them best? Which explain them in the context of specific languages, e.g., Ruby and Java? Which exercises can be used to teach them best, (i) interactively over the Web, (ii) to a class of students, via in-class exercises, (iii) for self-study?
Definition
A Class Responsibility Collaborator (CRC) model (Beck & Cunningham 1989; Wilkinson 1995; Ambler 1995) is a collection of standard index cards that are used when first determining which classes are needed and how they will interact. A CRC card always contain these sections:
- The class name: represents a collection of similar objects
- Its Super and Sub classes (if applicable)
- The responsibilities of the class: represents something a class knows or does
- The collaborator: The names of other classes with which the class will collaborate to fulfill its responsibilities.
- Author
An example of CRC card is shown in figure 1.
Figure 1
Advantages of CRC Card
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.
Best Page Related to CRC
CRC Cards for ATM Example is a very good page for a CRC card instantiation. We have browsed through hundreds of websites regarding to CRC card, and this page offers a clearest and most complete example using CRC card and Java implementation.
The example the page provides is how to design an ATM machine. It is absolutely not an easy task since an ATM machine has to interact with the bank and the user, and a transaction is also related to reading card and printing receipt. Moreover, the login system is essential to ensure security. In order to deal with the relationship of so many distinct classes of objects, we need the help of CRC card.
The description on the CRC card of each class makes it clear of the responsibility and collaborate class of the specific class, and facilitate the designer to design interfaces more easily.
Below is a complete list of the class used in an ATM machine design.
Boundary/entity objects - component parts of the ATM
- Class CardReader
- Class CashDispenser
- Class CustomerConsole
- Class EnvelopeAcceptor
- Class Log
- Class NetworkToBank
- Class OperatorPanel
- Class ReceiptPrinter
Controller objects corresponding to the various use cases
Entity objects found necessary when assigning responsiblities to other objects
Examples of CRC
Ruby Example
Java Example
Teaching Exercises for CRC
Exercise for Teaching Interactively over the Web
Exercise for Teaching in a Class
There is an example of how to use role playing to teach OO design through CRC cards by Jürgen Börstler Umeå University, Sweden. It not only works well at teaching CRC cards in class but also a good activity in class. Divide class into groups. Each member in the group presents an object (a CRC card). They can only think of their role. Their responsibilities and how they collaborate with others. Via this way, students can know how to define each CRC card by naming each role; to list what each role can do is to understand how to list responsibilities; to interact with other roles helps to figure out the collaborator of CRC cards.
Exercise for Self-study
Here is a good web page (http://www.agilemodeling.com/artifacts/crcModel.htm) for CRC cards self-study. It simple describes CRC cards at first and using an easy example to teach the rest. The example has only three main roles, student, seminar and professor. Because it’s an example relate to the student experience so it’s easy to understand.
- First, find the classes and how to name the classes.
- Second, find the responsibility.
- Third, define the collaborators to find out how each role interactive with others.
- Forth, move the cards around to more clearly figure out the relation of each class.
Why I think this is a good web site for self study? The example here is easy and close to student’s experience, therefore student can understand easily without others help.