Generalization

I l @ ve RuBoard

Generalization provides the capability to create superclasses that encapsulate structure and behavior common to several classes. This is very common in beginning analysis endeavors since the classes that currently exist are those that model the real world. Classes are examined for commonality of structure (attributes) and behavior (operations). For example, the Student and Professor classes both have name , address, and phoneNumber as attributes.

You should be on the lookout for synonyms since attribute and operation names are expressed in natural language and the commonality might be hidden. Additionally, look at attributes and behavior, which at first glance may seem specific, but in reality may be generalized. For example, the Student class has an attribute called studentID and the Professor class has an attribute called professorID. A general attribute called userID could be created to replace the studentID and the professorID as long as the individual IDs follow the same numbering scheme (e.g., they are both four-digit numbers ). If they are different (e.g., the studentID is a ten-digit alphanumeric and the professorID is a four-digit number) then they should be kept separate.

I l @ ve RuBoard


Visual Modeling with Rational Rose 2002 and UML
Visual Modeling with Rational Rose 2002 and UML (3rd Edition)
ISBN: 0201729326
EAN: 2147483647
Year: 2002
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net