CSC/ECE 517 Fall 2010/ch1 2b dg
Introduction
CRC Cards also known as Class-Responsibility-Collaboration cards are a brainstorming tool to enable collaboration across different teams or individuals in contribution to design, usually used in Object Oriented Software development. This was proposed by Ward Cunningham and Kent Beck[1]. The CRC card can be viewed as an index card, with the following details:
- The Top of the card usually bears the name of the class.
- The Left side of the card has the responsibilities of the class.
- The Right side of the card has the collaborating classes corresponding to each of the responsibilities listed in the left side.
Thus in general, a CRC session can be viewed as the interaction between a set of collaborating classes for a particular Use case.
According to [2]A CRC session proceeds with someone simulating the system by talking about which objects send messages to other objects. By stepping through the process weaknesses and problems are easily uncovered. Design alternatives can be explored quickly by simulating the design being proposed.
A CRC Example
To better understand how the CRC cards work together, let us consider an example.
Advantages of CRC cards
There are quite a few advantages of CRC cards that make it a preferable model in many designs. Some of the advantages of the CRC card design method are
- CRC cards can allow designers to easily make audience understand a very complex system. In essence it allows for building more complex designs by slowly building the interactions between the collaborating classes, one by one.
- CRC cards are a simple technique and it can be easily used by anyone with very little training and does not require any expensive computing resources(a board or a paper and a pen would suffice).
- CRC is fundamentally a brainstorming tool, enabling different people in a team to come up with the design by collaborating, enabling everyone in the team to contribute
- CRC can be used with other formal object oriented design methodologies such as Extreme Programming (an Agile development Technique) and can be used along with modelling languages such as Unified Modelling Language(UML)
Why need a Software for CRC Cards
CRC cards are limited by their scope. If we go about designing a huge project, the scope spans many classes and interactions between them. The tedious task of maintaining are CRC cards and to properly formulate interaction can get overwhelming. Following reasons propel use for software for CRC Cards :
- Designing Scenario: A scenario represents series of steps in which classes and objects communicate. There are be references to other cards or scenarios.
- Modeling : Software provide an easy way to segregate cards and objects into different diagrams. Thus we can model our software with different functionality very easily.
- Simulation : Software can provides simulation of an software design. This might include single stepping backwards, forwards a scenario or jumping to a specific location in the scenario stack of a multiple scenario simulation
- Synchronization and Dependencies: Software can maintain relationships between cards, scenarios as design changes take place. If a card references other cards or classes, those cards are generated automatically. Also any name changes and cross references between objects are instantly updated.
- Revision history and Version Control : Software for CRC cards supports changes to CRC cards. It is easy to model and keep track of all changes to a CRC cards. This is extremely helpful in realizing the design changes to CRC cards.
Desining Software
The following steps proceed while designing Software for CRC cards:
- Create CRC Cards
A CRC model is usually created by an individual or small group of designers during the early phase of an object-oriented development project.The figure shows the design of hierarchy of classes. These set of class used for drawing objects are shown. We can see TShape class has a superclass called TObject and two subclasses, TBox and TCircle. Lets assume we create new class TWindow derived from the superclass TObject.
- Assign Responsibilities
Once a set of classes are defined, behaviors can be assigned that will provide the functions of the application. For example, the TShape card has responsibilities Initialize to create it and Draw to illustrate it on the diagram.
- Add Attributes
Attributes of classes may also be identified in a CRC Card.The TShape class has attributes fPosition, fType and fSelected.
- Define and simulate Scenario
A scenario describes a sequence of steps in the design using the responsibilities of a group of collaborating classes. Collaboration between classes refers to a client object that uses a responsibility performed by a server object. Often a class must call upon several collaborating classes to implement one of its responsibilities.A scenario describes what happens in the system from a high-level, user point of view.
Consider situation to the right. We have defined two CRC cards with their responsibility. A scenario deinfes several steps. Each step in a scenario has a Client, Server and Responsibility field. For each step, a client class uses a responsibility of a server class
The Open Document scenario in the picture references the Initialize Document subscenario by specifying its server class Document in the server field and its scenario name in the Responsibility field. The first step in the Initialize Document subscenario uses Document as the server class name.
By single stepping forwards, backwards or through each subscenario, bugs in the design can be identified and corrected early.
- Partition the Design
As the number of CRC cards in the design grows, they can be grouped by function. Using Software for CRC cards, separate diagrams are used to partition the model into different subject areas.
- Inheritance Graph
An automated tool can generate an inheritance graph from information on CRC cards. This diagram can concisely illustrate the big picture of a large project that might contain hundreds of classes and dozens of diagrams.
- Verify Your Work
Creating and simulating scenarios will help verify that a design is correct and complete. A CRC software can perform other error checks to locate design problems. For example, responsibilities that are not used in any scenarios may indicate that the design is incomplete or perhaps the responsibility isn't needed.Likewise, a card that is not used by any collaboration may not be needed.
Summary
Software for CRC cards are immensely helpful in designing and modeling Software development using CRC cards.As the size of object-oriented system grow, it becomes increasingly difficult to model the problem with index based CRC cards. Thus an automated tool is required to maintain design and clear functionality.
References
[1] A Laboratory For Teaching Object-Oriented Thinking: http://c2.com/doc/oopsla89/paper.html
[2] CRC Cards: http://www.extremeprogramming.org/rules/crccards.html
See Also
External Links
- A Laboratory For Teaching Object-Oriented Thinking by Ward Cunningham and Kent Beck
- The CRC card book by David Bellin, Susan Suchman Simone