26.5. When to Define a Conceptual Superclass

Generalization into a common superclass is usually advised when commonality is identified among potential subclasses. The following are motivations to generalize and define a superclass:

Create a conceptual superclass in a generalization relationship to subclasses when:

  • The potential conceptual subclasses represent variations of a similar concept.

  • The subclasses will conform to the 100% and Is-a rules.

  • All subclasses have the same attribute which can be factored out and expressed in the superclass.

  • All subclasses have the same association which can be factored out and related to the superclass.

The following sections illustrate these points.

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, 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.