nus-cs2103-AY1920S1 / forum

Forum
1 stars 1 forks source link

Association label vs association role #135

Closed CoderStellaJ closed 5 years ago

CoderStellaJ commented 5 years ago

Can anyone help to point out why this diagram is false? And what's the difference between association role and association label? Thanks!

Quiz question: Which diagrams are acceptable representations of the highlighted association role? Capture

ambervoong commented 5 years ago

Association roles are used to indicate the role played by the classes in the association. For example, in an association between classes A and B, class A could play the role of the husband and class B plays the role of the wife.

Association labels are the ones shown in the diagram you linked. They describe the meaning of the association. An easy way to distinguish between them is the black arrow present in association labels. Also, it often describes a relationship whereas association roles tend to be nouns like 'friend' or 'helper'!

This diagram is false because an association label is shown in the diagram, not an association role. I can't remember exactly but I think the question was asking if this was a valid association role! Otherwise, it is a perfectly valid association label.

CoderStellaJ commented 5 years ago

Thanks for your contribution to this question. Because the quiz question asks whether the diagram shows the correct association role but the diagram shows association label. The diagram fails to show the role.