What are CRC cards? Are they really useful or just a waste of time? Why should I care? Where where were you on the night of December 25th? We all have asked these questions to ourselves at least once in our lives. And I’ll just answer the first one.
CRC (stands for Class, Responsibility and Collaboration) cards
(stands for Community Assistance for Reconstruction, Development, and Stabilisation) is an Object Oriented design pattern, useful.
These cards are supposed to help the software developer to think which objects he will need to have, what methods they will have and how will they interact among them, even before start writing code. It is supposed to be a good tool to learn the OOP paradigm because, regardless the syntax or implementation of an specific language, you can focus in what really matters, the whole concept of objects.
To write CRC cards you need to think about three things:
- Class (name):The class has to have a short and descriptive name of what it represents and what it does.
The problems that the class is supposed to solve and its procedures, these should be short verb phrases containing an active verb. This is typically what this class does when it interacts with other classes.
Objects should not be isolated from each other, they all must collaborate to accomplish a common goal, just like we learned from The Wonder Pets! Here you write with which other classes this one interacts with.
CRC cards have the following format and are written in 4×6 index cards:
With CRC cards you can clearly see the relationship between classes, and the index cards have the advantage that you can move them around, organize and overlap them so you can put them in certain position that helps you to think about the relationship between these classes.
And with this I answer to the fist question, you should be able to answer the second and third questions by yourself, maybe the fourth too.
Information and images extracted from http://c2.com/doc/oopsla89/paper.html
Permission to copy without fee all or pan of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to publish, requires a fee and/or specific permission.