How I use CRC (Class Responsibility Collaboration) Cards every day (Part 1)

What are CRC Cards?

When do I use them?

The answer to this is … all the fricken time. As a ‘Tech Lead’ they are invaluable to me as they allow me to abstract myself from the code but still offer value to my team by exploring problems with them.

Scenario 1

You/Your team have just finished a task. Woo hoo. Good job! Now is the time to reflect. Write up a CRC card(s) for the task you have just completed.

Scenario 2

You/Your team have just finished a story. Woo hoo! Good job! Now is the time to reflect. Write up a CRC card(s) for the story you have just completed.

Scenario 3

You/Your team have just finished an epic. Woo hoo! Good job! You lot are awesome. Now is the time to reflect! Write up a CRC card(s) for the epic you have just completed.

Top Tips

  1. Write a card for before and after the change and then compare.
  2. Write the cards based on the genuine code. Do not base it on some drawing or some memory you have of what it does or whatever. Open the code, read the code line by line, write it out as you do it. Make sure EVERYTHING is in there.
  3. In my view writing a good CRC card means introducing a level of abstraction from the code. Whilst the list of collaborators might be a 121 mapping to the objects, the responsibilities should be reflective of your domain NOT necessarily your code. What do I mean by that? Well lets say you have a ‘EmailAddressValidator’ object, its responsibility might be ‘validate email addresses’ however, it might take 3 functions to do that. Responsibility > Implementation.
  4. Throw them away. Often. If you can’t recreate these cards quickly then its often a code smell that your code is too complex — see ‘Software that fits in your head’
  5. If you can’t fit all the responsibilities and the collaborators on one side of the card then its often a code smell that your code is too complex — see above.
  6. If you are doing any kind of refactoring sessions, put the responsibilites and collaborators on seperate slithers of paper that you can stick with blue tack to the cards. Encourage people to move the bits of paper around.
  7. Rememeber to include ALL THE THINGS. Common things people don’t include but you should include include:
  • Configuration changes
  • Changes to test code
  • DB changes
  • Infrastructure

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
defmyfunc

defmyfunc

6 Followers

Thoughtworker. Views are my own. Retweets/likes don't mean I agree. All the usual caveats. Etc.