CRC cards are index cards used to represent classes, their responsibilities, and interactions during object-oriented design. Each CRC card lists the class name at the top, responsibilities along the left side, and collaborators on the right side. The iterative CRC modeling process involves finding key classes, identifying their responsibilities, defining collaborator classes, and arranging the cards based on collaboration. CRC cards have advantages such as being portable, involving, and useful throughout the software development lifecycle.
2. CRC Cards
⢠introduced in 1989 by Kent Beck and Ward
Cunningham
⢠designed to teach object oriented
programming at Tektronix
⢠a CRC card is an index card in a group
setting used to represent:
â a class of objects
â their behavior
â their interactions
4. CRC definitions
⢠Name
⢠The name, located at the top of the card, describes the
class that the CRC card represents.
⢠Responsibility
⢠Responsibilities are represented along the left side of the
card. Each distinct responsibility is on its own row.
⢠Collaborators
⢠Some responsibilities will collaborate with one or more
other classes to fulfill one or more Scenarios. Collaborators
are listed on the right hand side of the CRC card, next to
the responsibilities that they are helping to realize.
6. 1. Find Classes
⢠Find classes.
⢠Finding classes is fundamentally an analysis task because it deals with
identifying the building blocks for your application.
⢠A good rule of thumb is that you should look for the three-to-five main
classes right away, such as Student, Seminar, and Professor
7. 2.Find Responsibility
⢠Find responsibilities.
⢠You should ask yourself what a class does as well as what information
you wish to maintain about it.
⢠You will often identify a responsibility for a class to fulfill a
collaboration with another class.
8. 3. Define Collaborators
⢠Define collaborators.
⢠A class often does not have sufficient information to fulfill its
responsibilities. Therefore, it must collaborate (work) with other
classes to get the job done.
⢠Collaboration will be in one of two forms: a request for information or a
request to perform a task.
⢠To identify the collaborators of a class for each responsibility ask
yourself "does the class have the ability to fulfill this responsibility?".
If not then look for a class that either has the ability to fulfill the
missing functionality or the class which should fulfill it. In doing so
you'll often discover the need for new responsibilities in other classes
and maybe even the need for a new class or two.
9. 4.Move the cards around
⢠Move the cards around.
⢠To improve everyone's understanding of the system, the cards should
be placed on the table in an intelligent manner.
⢠Two cards that collaborate with one another should be placed close
together on the table, whereas two cards that don't collaborate should
be placed far apart.
⢠Furthermore, the more two cards collaborate, the closer they should
be on the desk.
⢠By having cards that collaborate with one another close together, it's
easier to understand the relationships between classes.
10. Advantages
⢠portable: cards can be used anywhere, even away
from the computer or office
⢠anthropomorphic: no computer program can
capture the essence of the interactions forced
by passing the cards
⢠level of involvement felt by each team member
increases
⢠useful throughout the life cycle
11. More advantages
⢠provides a basis for more formal analysis and
design methodologies
⢠serves as input to a formal method (i.e., a starting
point)
⢠ease the transition from process orientation to
object orientation - most formal methods are
overwhelming
⢠gives a general bound on the size of a class - a card