Identifying Object Relationships, Attributes and Methods
Identifying Object Relationships, Attributes and Methods
• Association
• Association is a relationship between two objects. In other
words, association defines the multiplicity between
objects. You may be aware of one-to-one, one-to-many,
many-to-one, many-to-many all these words define an
association between objects. Aggregation is a special form
of association. Composition is a special form of
aggregation.
• Top-down
• Look for noun phrases composed of various adjectives on class
name.
• Example, Military Aircraft and Civilian Aircraft.
• Only specialize when the sub classes have significant behavior.
• Bottom-up
• Look for classes with similar attributes or methods.
• Group them by moving the common attributes and methods to
super class.
• Do not force classes to fit a preconceived generalization structure.
Reusability
• Move attributes and methods as high as possible in the
hierarchy.
• At the same time do not create very specialized classes at the
top of hierarchy.
• This balancing act can be achieved through several iterations.
Multiple inheritance
• Avoid excessive use of multiple inheritances.
• It is also more difficult to understand programs written in
multiple inheritance system.
• Class Responsibility: Identifying Attributes and Methods
• Identifying attributes and methods, like finding classes, is a
difficult activity.
• The use cases and other UML diagrams will be our guide for
identifying attributes, methods, and relationships among
classes.