Nic McPhee
University of Minnesota, Morris
Not surprisingly, there seems to be some confusion about exactly what these CRC cards are about. In this document I'll try to provide some tips and guidelines along with a specific examples.
First, let's assume here that we're starting with a scenario and trying to lay out the major players. A scenario should be a complete sentence, and as such it should have nouns and verbs. The nouns should be the entities or classes in the system, and they will almost always turn into specific cards, with different nouns turning into different cards. The verbs in the scenario typically turn into the responsibilities of some card, i.e., some action an entity is capable of performing. Note, however, that complex activities often turn into a number of different actions performed by several different entities. The collaborators section of a card is the list of entities (other cards) that this particular card is going to have to know about, i.e., directly access. When working through a scenario you only need to worry about the pieces necessary for that scenario. Don't make the mistake of trying to (re)invent the entire system every time you work through a new scenario.
Let's take a non-technical example: "You (the student) e-mail my parents your resume as an e-mail attachment". What are the nouns here? I see
I can see several ways of plugging this gap:
If I were to take the second option above and write out all the pieces, I'd probably get something like:
|
|
||||||
|
|
Note here that there is much that isn't mentioned because it's not necessary for this scenario. Your resume, for example, has no responsibilities or collaborators in this scenario; it's just a lump travelling about. My parents are also rather boring in this scenario. In a real system there would presumably be other scenarios that introduce other behaviors to these nouns, as well as new nouns. There might, for example, be a scenario where my parents actually do something with your resume, like stick it on their fridge next to our son's latest art work. This would introduce new verbs to their card ("Stick document on fridge"), as well as new nouns to the system ("Fridge").
Note also that we don't need to list something as a collaborator of an entity unless that entity needs to be able to directly access it. In our scenario, for example, my parents and I never need to be able to access anything directly since we're just passive agents processing requests.
While this example may seem silly and contrived, you can change the labels and get a very real example. Imagine, for example, that instead we have a system that generates documents which are then entered into one of several databases. "You" are the entity that generates the document ("Your resume"). "I" am the entity that decides which database the document belongs in and gives you the address (or, perhaps, the password) for that database. "My parents" is the mediator for the given database that receives and processes requests, and the "Fridge" is the actual (possibly remote) database engine where the information is stored.
End of CRC card example
Feel free to send me some mail:
mcphee@morris.umn.eduUnless otherwise indicated, all material in these Web pages Copyright 1998, Nic McPhee. These materials may be redistributed provided that this notice remain attached and intact. Under no circumstances can this material be sold or distributed for compensation of any kind without prior written permission from the author.