OOPortal OOPortal


OO Concepts   «Prev 

Responsibilities and Collaborators

Collaboration

In OOP, classes collaborate with other classes to carry out all their necessary responsibilities.
For example, the CheckingAccount class might need to collaborate with the Person class and the Transaction class to collect all the information required to generate a monthly statement, because a statement would contain information stored in all three classes. Thus, the final step in object-oriented analysis is to identify the class's collaborators.
This style of analysis is called CRC modeling. CRC stands for Class-Responsibility-Collaborator
Once a CRC model of a system has been built, the classes are defined. Each class has a public interface that is reflected in the CRC model. Each class also has a private implementation that is hidden from everything except the class itself. The private implementation can be changed without affecting the public interface.

A (CRC) Class Responsibility Collaborator model is a collection of standard index cards that have been divided into three sections, as depicted in Figure 1.
  1. A class represents a collection of similar objects,
  2. a responsibility is something that a class knows or does, and
  3. a collaborator is another class that a class interacts with to fulfill its responsibilities.
CRC Card Layout
Figure 1