I have 2 classes Job
and Task
. These are the rules:
- Each
Job
has a numeric identifier. - Each
Job
has 10 correspondingTask
s. - Each
Task
has a numeric identifier. - A
Task
cannot exist without aJob
.
I am trying to build Class diagram for these 2 classes. Since Task
cannot live without Job
so I thought this is a composition and this is how I build the Class diagram:
But now I am confused that if this association is actually dependency:
How can I know in this case if the relationship is composition or dependency?
UPDATE
I have fixed the composition (Composite Aggregation) in the Class diagram as Thomas Kilian suggested: