-4

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

Is my diagram correct? enter image description here

Perhaps the second option is beeter? enter image description here

1

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.

1
  • 1
    I would usually assume a film to be something which could exist apart from being stored on a disc (it could be also on celluloid, or on a completely different storage media), hence a composition does IMHO not make much sense. But you are right, not every system follows common sense, someone may want to model films to be a group of discs.
    – Doc Brown
    Sep 16 at 8:27
-1

To present the role name and multiplicity in UML association, your example should be modelled as the picture below:

enter image description here

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/

1
  • For downvoters, please help the other by telling me what's wrong with my answer. Thanks.
    – Hieu Le
    Sep 16 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.