Cardinality

Gilbert and McCarty describe cardinality as the number of objects that participate in an association and whether the participation is optional or mandatory. To determine cardinality, ask the following questions:

  • Which objects collaborate with which other objects?

  • How many objects participate in each collaboration?

  • Is the collaboration optional or mandatory?

For example, let's consider the following example. We are creating an Employee class that inherits from Person, and has relationships with the following classes:

  • Division

  • JobDescription

  • Spouse

  • Child

What do these classes do? Are they optional? How many does an Employee need?

  • Division

    • This object contains the information relating to the division that the employee works for.

    • Each employee ...

Get Object-Oriented Thought Process, The, Second Edition now with O’Reilly online learning.

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