CRC Card Diagram
A CRC (Class, Responsibility, Collaborator) card diagram is a useful tool for object-oriented design and analysis. It is a simple, visual representation of a class, its responsibilities, and its collaborators.
CRC Card Structure
The CRC card element has a simple structure - with a name, a subclass, and a list of superclasses at the top and two columns for Responsibilities and Collaborators below. The Superclass and Subclasses sections specify the relationship of the class to other classes.
- Name - is typically a noun that describes the main function or purpose of the class. (e.g. a class representing a bank account might be called "Account".)
- Responsibility - is a brief description of what the class is responsible for. This is typically a verb phrase that describes the actions or tasks that the class can perform. (e.g. the "Account" class might have the responsibility of "managing balance" and "managing transactions")
- Collaborator - is another class that the class on the card works with or depends on to fulfill its responsibility. The card class needs to interact with the collaborator class in order to complete its tasks. On the card, it is displayed as the name of the other class. (e.g. the "Account" class might collaborate with a "Bank" class and "Client" class.)
Add CRC Card Diagram
To create a new CRC card diagram, click on the plus button in the tab bar and choose CRC Card Diagram item from the Other group.
You can use the toolbox next to the diagram editor to add a new CRC card element to the diagram. The context bar offers quick editing options to add a Responsibility or a Collaborator to the CRC card using the buttons Add Responsibility and Add Collaborator.
CRC Card Properties
The properties of a CRC card can be edited using the Properties dialog, which is accessible from the context menu for the selected CRC card. This dialog includes two tabs specific to CRC cards: the Header tab, which allows you to edit the Superclass and Subclasses, and the Responsibilities tab, which allows you to edit responsibilities and collaborators. The items in these lists can be edited directly in the grid, or using the Add and Remove buttons.