Professional Documents
Culture Documents
CHAPTER IN BOOK- 8
DAY- 16
-K. Indhu
SYLLABUS COVERED HERE
• Identifying Object Relationships
• Associations
• Super – Sub Class
• Aggregation – I
31-JAN-14 K. INDHU 2
GOALS
• Few Quote on Object Relationship by Researchers
• Introduction on Identifying Object Relationships
1. Association
– What?
– Diagrammatic Representation
– Guidelines for identifying Associations
– Common Association Patterns
– Eliminate Unnecessary Associations
2. Super – Sub Class Relationship
– What?
– Guidelines for Identifying Super – Sub Class Relationship
– Multiple Inheritance
3. Aggregation
– What?
– Properties of Aggregation
7-FEB-14 K. INDHU 3
FEW QUOTES BY RESEARCHERS
• “Objects contribute to the behavior of the system
by collaborating with one another.”
• —Grady Booch
1. Association:-
– How are objects associated (related)? This information will guide us in
designing classes.
2. Super-Sub Structure (also known as generalization hierarchy):-
– How are objects associated into superclasses and subclasses? This
information provides us the direction of inheritance.
3. Aggregation and a-part-of structure:-
– What is the composition of complex classes? This information guides us
in defining mechanism like object-within-object.
7-FEB-14 K. INDHU 5
ASSOCIATIONS
• Association represents a physical or conceptual connection
between two or more objects.
7-FEB-14 K. INDHU 6
ASSOCIATION
-DIAGRAMMATIC REPRESENTATION
7-FEB-14 K. INDHU 7
GUIDELINES
- FOR IDENTIFYING ASSOCIATIONS
• Identifying Associations begins by analyzing the
INTERACTIONS between classes.
7-FEB-14 K. INDHU 8
GUIDELINES
- FOR IDENTIFYING ASSOCIATIONS
• A dependency between two or more classes may be an association.
7-FEB-14 K. INDHU 9
COMMON ASSOCIATION PATTERNS
• Common association patterns include:-
1. Location Association: next To, part of, contained in,
ingredient of etc. .
– For example cheddar cheese is an ingredient of the French
soup.
2. Communication association: talk to, order to.
• For example, a customer places an order with an
operator person.
7-FEB-14 K. INDHU 10
ELIMINATE UNNECESSARY ASSOCIATIONS
1. Implementation Association:-
– Defer (postpone) implementation-specific associations to the design phase.->
POSTPONE INTERFACE RELATED ASSOCIATIONS TO DESIGN PHASE.
– Implementation Associations are concerned with the implementation or
design of the class within certain programming or development environments.
2. Ternary Association:-
– Ternary or n-ary association is an association among n-classes.
– Ternary Association complicate the representation.
7-FEB-14 K. INDHU 11
DERIVED ASSOCIATION EXAMPLE
7-FEB-14 K. INDHU 12
SUPER-SUB CLASS RELATIONSHIIPS
• The super-sub class relationship represents the inheritance relationship
between related classes.
• Recall that at the top of the class hierarchy is the most general class, and
from it descend all other, more specialized classes.
7-FEB-14 K. INDHU 13
GUIDELINES FOR IDENTIFYING:-
SUPER-SUB CLASS RELATIONSHIPS
1. Top – Down:-
• Look for noun phrases composed of various adjectives in a class name.
7-FEB-14 K. INDHU 14
GUIDELINES FOR IDENTIFYING:-
SUPER-SUB CLASS RELATIONSHIPS
2. Bottom - Up:-
• Look for classes with similar attributes or methods.
• The Sub Class will have only certain attributes and methods
specific to it.
7-FEB-14 K. INDHU 15
GUIDELINES FOR IDENTIFYING:-
SUPER-SUB CLASS RELATIONSHIPS
3. Re-usability:-
• Move attributes and methods as high as possible in the
hierarchy.
7-FEB-14 K. INDHU 16
GUIDELINES FOR IDENTIFYING:-
SUPER-SUB CLASS RELATIONSHIPS
4. Multiple Inheritance:-
• Avoid excessive use of multiple inheritance.
7-FEB-14 K. INDHU 17
A-PART-OF RELATIONSHIP- AGGREGATION
• A-part-of relationship, also called aggregation,
represents the situation where a class consists of several
component classes.
• This does not mean that the class behaves like its parts.
• For example, a car consists of many other classes, one
of them is a radio, but a car does not behave like a
radio.
7-FEB-14 K. INDHU 18
A-PART-OF RELATIONSHIP- AGGREGATION
• Two major properties of a-part-of relationship are:
– Transitivity:-
• If A is part of B and B is part of C, then A is part of C.
• For example, a carburetor is part of an engine and an engine
is part of a car; therefore, a carburetor is part of a car.
– Anti-Symmetry:-
• If A is part of B, then B is not part of A.
• For example, an engine is part of a car, but a car is not part
of an engine.
7-FEB-14 K. INDHU 19
HAPPY LEARNING!!!