Lecture 2

Tuesday, June 3, 2008

CRC Cards

Class Responsibility Collaborator (CRC cards) are a brainstorming tool used in the design of object-oriented software. They were proposed by Ward Cunningham and Kent Beck. There original purpose was to teach programmers the object-oriented paradigm.

Why uses CRC cards?

  • They are portable... No computers are required so they can be used anywhere. Even away from the office.
  • They allow the participants to experience firsthand how the system will work. No computer tool can replace the interaction that happens by physically picking up the cards and playing the role of that object...
  • They are a useful tool for teaching people the object-oriented paradigm.

What is a CRC CARD?

Nothing more than a blank card of 6 X 4 inches. In that card, you can draw a table something like this

By reading the spec you will come across nouns. For each nouns that you feel that can be a class, allocate a card and write the class name on top. Then reading further you will find the thing that can be done or has to be done by that class. Those are the responsibilities. Write down those responsibilities in the relevant cards. There are other classes that this class will communicate or this class should know that “there is a class like this”. Those are called collaborators. Write class names of the collaborators under the collaborator column.


Duleepa Karunaratne said...

Requirement spec
Business analyses go to the client to get the requirements. After gathering the requirements they prepare the document called Requirement Specification or SRS. This is some sort of an agreement between the client and the development company. As we know the requirements of software system is always changing. But with this changing requirement, it’s very hard to proceed with the project. So there should be some point where both parties should agree at a certain level of requirements, and until the end of the project those requirements should not be changed. In other words the company and the client are agreeing on the requirements that will be covered by the system, but nothing more than that.

This is the most important document in the project, since whole implementation of the project will depend on the content of this document. So it’s very important that the requirement spec should be understandable, unambiguous and has no contradictory statements (or requirements).

After getting the spec, the system analysis’s task is to develop a model, to understand the problem better and to explain it to somebody else easily. Most of the time, this model involves drawing. To develop the model the analysis need to identify the classes, objects and their behaviors from the spec. So they need a particular method to extract information from this document. One of the methods they are using is the CRC cards.

CRC Cards
It is used as a brainstorming tool. Few people are involved in this process. One person is reading the requirement spec, while the others hear. When they come across a particular noun (which seems to be important), one person gets it and assign it to himself. Then he tries to identify his role in the system and the thing he should know about the system. For an example if we are to implement a “Banking system”, one person can act as the “Bank Account”. Then he will try to identify (from the spec) the responsibilities he has in the system. This may be deposit money, withdraw money etc. in addition to this he should know about other classes in the system. Let’s assume in this particular account, cheques can be deposited. So the Bank Account should know there is another class called Cheque, whom he can collaborate with and carry on the responsibility of depositing the Cheques. These are called Collaborators. So the person who was assigned as the Bank Account will pick a CRC card and name it as BankAccount and write down the responsibilities of the Bank Account (which were mentioned in the spec.) under the responsibility column, and write down the classes he need to collaborate with, under the collaborators column.

Likewise the team continues this process until they cover the complete spec. and finally they will end up filling number of CRC card for the identified classes with their behaviours.

This may be a time consuming operation, but it helps to understand and visualise the model very easily and correctly.