Generalization
Generalization
Definition
Generalization is a bottom-up EER (Enhanced ER) modeling process in which two or more entity sets that share common attributes are abstracted into a single, more general superclass (supertype) entity set. It reduces redundancy by factoring out shared attributes into one place.
Worked Example
Suppose the college database initially models Student and Employee (which includes teaching and non-teaching staff) as two completely separate entity sets, each independently storing Name, DateofBirth, Address, and Email. Recognizing this duplication, the designer generalizes them bottom-up into a common superclass Person, holding the shared attributes (Name, DOB, Address, Email, PersonID), while `Student` and `Employee` remain as **subclasses** holding only their own specific attributes (RollNo, CGPA for Student; Employee_ID, Salary, Designation for Employee).
Edge Cases
- Generalization is explicitly the reverse direction of specialization (6.18): generalization starts from existing lower-level entity sets and merges upward into a superclass; specialization starts from an existing entity set and splits it downward into subclasses. They arrive at the same ISA (superclass/subclass) hierarchy structure but via opposite reasoning processes.
- Generalization typically implies the resulting subclasses are disjoint or overlapping, and total or partial, in their coverage of the superclass — these EER constraints determine, for example, whether every Person must be either a Student or an Employee (total) or could be neither (partial), and whether a Person could be both at once (overlapping) or must be exactly one (disjoint).
- Do not confuse generalization with aggregation (6.19) — generalization is about factoring common attributes of similar entity sets into an ISA hierarchy; aggregation is a completely unrelated concept about treating an entire relationship as a higher-level entity so it can itself participate in further relationships.
- Generalization does not create a new relationship diamond; the superclass/subclass link is drawn with a distinct ISA triangle/arrow notation in EER diagrams, not the diamond used for ordinary relationships.
Key Takeaways / Interview Q&A
Q: What direction of reasoning does generalization follow — bottom-up or top-down? A: Bottom-up: you start with existing specific entity sets and merge their shared features into a new general superclass.
Q: How is generalization different from specialization, given they produce the same hierarchy? A: They are inverse design processes leading to the same structure — generalization merges existing subclasses upward into a superclass; specialization starts from a superclass and splits it downward into new subclasses.
Q: Is generalization the same idea as aggregation? A: No — generalization is about ISA hierarchies (superclass/subclass) from shared attributes; aggregation is about elevating a relationship itself into an entity so it can participate in other relationships. They solve entirely different modeling problems.