0.6.18 Modeling Data in a Class Diagram

Turn Soccer Record Requirements into a Class Model

Roster records can suggest useful software types, but converting data to classes is a design task. Ask which information an object should hold and which related objects it should be able to reach.

Here the software needs Player objects with a name and jersey number, each referring to one Team. Team objects have a name. The example assumes the software has already loaded and linked the data successfully.

Read the Data Meaning
Sample records, not class definitions
Team record: T01, Wildcats
Player record: P007, Jordan, 7, T01
Player record: P001, Casey, 1, T01

Each player row suggests the same Player type, not another class for Jordan or Casey. The repeated T01 values identify a shared team in the stored data. In the running object model, a Team reference can express that relationship directly.

Player defines name and jerseyNumber and requires a team reference to one Team. Team defines its name.
A software structure for the loaded roster
  • New
  • Changed
  • Removed
Make Each Modeling Choice Explicit
  1. Choose one class for each useful software responsibility or kind of object.
  2. Translate required simple values into named, typed attributes.
  3. Choose whether relationships become object references, identifiers, or both, based on the software's job.
  4. State whether an object may temporarily lack a relationship. This completed-roster view requires one Team per Player.
Test the Conversion