crc cards

12
CRC Cards CRC Cards (class-responsibility- (class-responsibility- collaborator) collaborator) Preeti Mishra Preeti Mishra Course Instructor Course Instructor

Upload: preeti-mishra

Post on 31-Jul-2015

126 views

Category:

Software


7 download

TRANSCRIPT

Page 1: Crc cards

CRC CardsCRC Cards(class-responsibility-(class-responsibility-

collaborator)collaborator)

Preeti MishraPreeti Mishra

Course InstructorCourse Instructor

CRC CardsCRC Cards(class-responsibility-(class-responsibility-

collaborator)collaborator)

Preeti MishraPreeti Mishra

Course InstructorCourse Instructor

Page 2: Crc cards

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

Page 3: Crc cards

CRC Card format

Page 4: Crc cards

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.

Page 5: Crc cards

So how do you create CRC So how do you create CRC models? Iteratively perform models? Iteratively perform

the following steps:the following steps:

Page 6: Crc cards

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

Page 7: Crc cards

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.

Page 8: Crc cards

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.

Page 9: Crc cards

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.

Page 10: Crc cards

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

Page 11: Crc cards

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

Page 12: Crc cards