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]. 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. For example, consider the superclass Payment and its subclasses ( CashPayment , and so on). Assume the definition of Payment is that it represents the transaction of transferring money (not necessarily cash) for a purchase from one party to another, and that all payments have an amount of money transferred. The model corresponding to this is shown in Figure 32.3. A CreditPayment is a transfer of money via a credit institution which needs to be authorized. My definition of Payment encompasses and is more general than my definition of CreditPayment . 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. For example, in terms of set membership, all instances of the set CreditPayment are also members of the set Payment . In a Venn diagram, this is shown as in Figure 32.4. 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 . All Payment subclasses must conform to having an amount and paying for a Sale . In general, this rule of conformance to a superclass definition is the 100% Rule : 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: attributes associations 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. For instance, the statement CreditPayment is a Payment makes sense, and conveys the notion of set membership conformance. 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: 100% Rule (definition conformance) Is-a Rule (set membership conformance)
Generalization and Conceptual Class Definition
Figure 32.3. Payment class hierarchy.
Generalization and Class Sets
Figure 32.4. Venn diagram of set relationships.
Conceptual Subclass Definition Conformance
Figure 32.5. Subclass conformance.
Conceptual Subclass Set Conformance
What Is a Correct Conceptual Subclass?