CSC/ECE 517 Fall 2012/ch1 w43

From Expertiza_Wiki
Revision as of 21:51, 3 October 2012 by Smahish (talk | contribs)
Jump to navigation Jump to search

Class-Responsibilty-Collaboration Cards

Class Responsibility Collaboration (CRC) cards are a brainstorming tool used in the design of object-oriented software. They were proposed by and Ward Cunningham and Kent Beck. They are typically used when first determining which classes are needed and how they will interact.


Introduction

CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.

A CRC-card corresponds to a class.

A responsibility is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card.

A collaborator is an object of another class "helping" to fulfill a specific responsibility.

The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.


The structure of a CRC-card is as shown below.

CRC cards are usually created from index cards on which there are written:

1. The class name

2. Its Super and Sub classes (if applicable)

3. The responsibilities of the class.

4. The names of other classes with which the class will collaborate to fulfill its responsibilities.

5. Author

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 her/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.


CRC Models

A CRC model is a collection of CRC cards that represent whole or part of an application or problem domain. The most common use for CRC models is to gather and define the user requirements for an object-oriented application. The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table. Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.


Creating a CRC model

The steps in creating a CRC model are:

1. Put together the CRC modeling team.

2. Organize the modeling room.

3. Do some brainstorming.

4. Explain the CRC modeling technique.

5. Iteratively perform the steps of CRC modeling. 6. Perform use-case scenario testing


Example CRC

Advantages of CRC cards

Disadvantages of CRC cards

CRC card tools

QuickCRC

Quick CRC is a software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. simulated. The inheritance graph instantly shows the class structure of the evolving design.


Easy CRC

The use of the Easy CRC tool is divided into two: First, it helps in identifying the object, which are the CRC cards, from plain regular language and second, it identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.