32.3. Defining Conceptual Superclasses and Subclasses
Since it is valuable to identify conceptual super- and subclasses, it is useful to clearly and precisely understand generalization, superclasses, and subclasses in terms of class definition and class sets.MO95].
Generalization and Conceptual Class Definition
What is the relationship of a conceptual superclass to a subclass?
Definition A conceptual superclass definition is more general or encompassing than a subclass definition. |
Figure 32.3. Payment class hierarchy.
Generalization and Class Sets
Conceptual subclasses and superclasses are related in terms of set membership.
Definition All members of a conceptual subclass set are members of their superclass set. |
Figure 32.4. Venn diagram of set relationships.
Conceptual Subclass Definition Conformance
When a class hierarchy is created, statements about superclasses that apply to subclasses are made. For example, Figure 32.5 states that all Payments have an amount and are associated with a Sale .
Figure 32.5. Subclass conformance.
Guideline: 100% Rule 100% of the conceptual superclass's definition should be applicable to the subclass. The subclass must conform to 100% of the superclass's:
|
Conceptual Subclass Set Conformance
A conceptual subclass should be a member of the set of the superclass. Thus, CreditPayment should be a member of the set of Payments .Informally, this expresses the notion that the conceptual subclass is a kind of superclass. CreditPayment is a kind of Payment . More tersely, is-a-kind-of is called is-a .This kind of conformance is the Is-a Rule :
Guideline: Is-a Rule All the members of a subclass set must be members of their superclass set.In natural language, this can usually be informally tested by forming the statement: Subclass is a Superclass. |
What Is a Correct Conceptual Subclass?
From the above discussion, apply the following tests[3] to define a correct subclass when constructing a domain model:
[3] These rule names have been chosen for their mnemonic support rather than precision.
Guideline A potential subclass should conform to the:
|