I'm having trouble with modeling the association between movies and DVD disks - it's my homework for university.
So I have a "Film" class and a "Disk" class.
- One film can be on multiple disks (at least one)
- Each disk can have only one film
I'm having trouble with modeling the association between movies and DVD disks - it's my homework for university.
So I have a "Film" class and a "Disk" class.
So I have a "Film" class and a "Disk" class.
- One film can be on multiple disks (at least one)
- Each disk can have only one film
Both bullets belong to the same association between the "Film" and "Disk" classes and they tell us something about the multiplicities at each end of the association.
It is a single association, because the questions "Which disks is this film burned on?" and "Which film is burned/contained on this disk?" are asking for the same real-world information, just from slightly different starting points.
That makes your second diagram better, as it shows only a single association (with a single set of multiplicities).
But between the two diagrams, you have also changed the type of association, from a plain association in the first one to a composition in the second diagram. A composition relation is much stronger than a plain association and implies that a Film and a Disk cannot exist without each other. You have not provided enough information to tell if that strengthening of the association is correct or not.
To present the role name and multiplicity in UML association, your example should be modelled as the picture below:
I used association because I don't know if this association is a composition or an aggregation. See more at https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/