Identifying Object Relationships, Attributes and Methods
Identifying Object Relationships, Attributes and Methods
Identifying Object Relationships, Attributes and Methods
– Super-Sub Structure
Cheese Soup
Part of
• Communication Association -
talk-to, order-to, etc.,
Customer Operator
Order-to
Eliminate Unnecessary associations
• Implementation Association -
The implementation specific association should be concentrated
only in the design phase. So eliminate them
• Ternary Association -
They are very complicated. Hence decompose them into simple
binary associations
• Directed Association -
Directed or derived associations are one which can be defined in
terms of other associations. Since they are redundant, avoid them.
John Ken
Grandparent of
• Bottom-up
Look for the classes with similar attributes or methods. The commons
are grouped into super class
• Reusability
Move the attributes and behaviors to the top-level of the hierarchy.
Don’t create specialized class in the top-level.
• Multiple Inheritance
Avoid using multiple inheritance. Since they are very
complicated in implementation point of view. Use only the
class that is more appropriate as super class and define the
other class’s attributes here also.
Aggregation
• Represents the situation where a class consists of several
component classes
Properties of Aggregation
• Transitivity
If A is a part-of B and B is a part-of C. Then A is a
part-of C.
• Antisymmetry
If A is a part-of B. Then B is Not a part-of A.
Identifying Aggregation
• The following questions are answered for identification of
aggregation
– Does the part class belong to the problem domain?
– Is the part class within the system’s responsibilities?
– Does the part class capture more than a single value? If single
value then set it as an attribute.
– Does it provide a useful abstraction in dealing with problem
domain?
Aggregation Relationship Patterns
• Assembly -
An assembly is constructed from its parts.
E.g.., Coffee is assembly of Coffee powder, water
• Container -
The container contains, not constructed from the parts.
E.g.., House contains furniture and other appliances.
• Collection member -
Collection of conceptual or physical parts.
E.g.., Cricket team is a collection of players
Identifying Attributes