How to do it...

  1. Write down simple sentences that describe what an instance of the class does. We can call these the problem statements. It's essential to focus on short sentences, and emphasize the nouns and verbs:
    • The game of Craps has two standard dice.
    • Each die has six faces, with point values from one to six.
    • Dice are rolled by a player.
    • The total of the dice changes the state of the craps game. Those rules are separate from the dice, however.
    • If the two dice match, the number was rolled the hard way. If the two dice do not match, the number was easy. Some bets depend on this hard-easy distinction.
  2. Identify all of the nouns in the sentences. Nouns may identify different classes of objects. These are collaborators. Examples include ...

Get Modern Python Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.