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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.