Structured Modelling Using Class Diagrams v1
Structured Modelling Using Class Diagrams v1
SOFTWARE ENGINEERING
display()
Operations hide()
Class Symbols
Class Symbols (2)
Associations
• An association between two classes indicates that objects at one
end of an association “recognize” objects at the other end and may
send messages to them.
• Instance of one class must know about the other in order to
perform its work
Employee Company
Associations (cont.)
Role
name
Association
name
instructor
StaffMember Student
1..* instructs *
Role
Navigable
Multiplicity (uni-directional)
association * pre -
requisites
Courses
0..3
Reflexive
association
Associations (cont.)
• To clarify its meaning, an association may be named.
• The name is represented as a label placed midway along the association line.
• Usually a verb or a verb phrase.
• A role is an end of an association where it connects to a class.
• May be named to indicate the role played by the class attached to the end of
the association path.
• Usually a noun or noun phrase
• Mandatory for reflexive associations
Associations (cont.)
• Multiplicity
• the number of objects that participate in the association.
• Indicates whether or not an association is mandatory.
Multiplicity Indicators
2..* 1..*
Car Door House
Whole Part
Aggregation (cont.)
• Aggregation tests:
• Is the phrase “part of” used to describe the relationship?
• A door is “part of” a car
• Are some operations on the whole automatically applied to its parts?
• Move the car, move the door.
• Are some attribute values propagated from the whole to all or some of its parts?
• The car is blue, therefore the door is blue.
• Is there an intrinsic asymmetry to the relationship where one class is subordinate to the
other?
• A door is part of a car. A car is not part of a door.
Composition
• A strong form of aggregation
• The whole is the sole owner of its part.
• The part object may belong to only one whole
• Multiplicity on the whole side must be zero or one.
• The life time of the part is dependent upon the whole.
• The composite must manage the creation and destruction of its parts.
1 Circle
Circle Point
3..* Point
Polygon
Generalization
• Indicates that objects of the specialized class (subclass) are
substitutable for objects of the generalized class (super-class).
• One class is the superclass of the other