Relationships
- A relationship is a connection among things
- Graphically represented with different kinds of lines used to distinguish the kinds of relationships
There are three major kinds of relationships. They are:
Dependency
Generalization
Association
|
Dependency
- A dependency indicates a semantic relationship between two or more classes in which a change in one may force changes in the other although there is no explicit association between them
- Graphically, a dependency is rendered as a dashed directed line, directed to the independent thing
Generalization
- In generalization relationship one element (the parent) is generalization of another element (the child)
- It is also called as "is-a-kind-of" relationship
- Graphically represented as a solid directed line with a large open arrowhead, pointing to the parent
Association
Association is a structural relationship where objects of one class are connected to objects of another class.
- An association is
Used to show a 'knows-a' relationship
Either unidirectional or bidirectional
Represented by solid line with a label (optional) and with a direction indicator
|
- Associations may optionally have role names and multiplicity symbols on either end of the association line (next to the class icon)
Association properties
Name
Describes the nature of the relationship to convey the meaning clearly
Direction
A triangle pointer in the direction that we want to read the name
Role
A class may play specific role in a relationship A class can participate in many associations and thus have multiple (different) roles
Multiplicity
Multiplicity
|
Representation
|
Exactly one
|
1
|
Zero or one
|
0..1
|
Many
|
0..*
|
One or more
|
1..*
|
Association Types
Aggregation is
- Used to show a 'has-a' or a 'whole-part' relationship
- It is represented as a solid line with an open diamond on the 'whole' end
- The part cannot exist without the whole. For example, if the school closes down all the departments will go away with it