Within a supertype/subtype design, what is a subtype discriminator?

Difficulty: Easy

Correct Answer: An attribute of the supertype whose values determine the subtype

Explanation:

Introduction / Context:The subtype discriminator is a cornerstone of implementing generalization and specialization. It provides a data-driven way to decide which subtype an instance of the supertype belongs to.

Given Data / Assumptions:

  • A single supertype has one or more subtypes.
  • There is a need to route instances to the correct subtype based on a value.
  • The discriminator is stored at the supertype level to be available for all instances.

Concept / Approach:A subtype discriminator is an attribute on the supertype whose value indicates which subtype applies. Example: a Person supertype may use attribute person_type with values Employee, Customer, or Vendor to determine the respective subtype.

Step-by-Step Solution:

Identify where the decision must be made: at the point where all instances exist, the supertype.Recognize the discriminator as a supertype attribute, not a subtype attribute.Pick the option that reflects this definition.

Verification / Alternative check:Design patterns for single-table inheritance or class table inheritance rely on a discriminator at the parent to route behavior or storage.

Why Other Options Are Wrong:

  • Subtype attribute cannot consistently determine subtype membership for the entire supertype population.
  • Statements that the supertype attribute determines the supertype are tautologies and not meaningful.

Common Pitfalls:Thinking the discriminator belongs in each subtype; that would defeat consistent determination and introduce redundancy.

Final Answer:An attribute of the supertype whose values determine the subtype

More Questions from ER Model and Business Rules

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion