CSC/ECE 517 Fall 2007/wiki2 5 kq

From Expertiza_Wiki
Jump to navigation Jump to search

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.

A common method to determine what cards should be created is to read a specification for the program being designed and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.

Best Page Related to CRC

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 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

Reference