How to draw compositions of multiple fields that have the same class type?

132 Views Asked by At

I’m sorry if the title is not clear enough. FYI, I’m trying to make an UML diagram from a class. Here’s a snippet of the class:

class ItemDisplay {
    Item currentItem;
    Item[] suggestedItems;
    Item[] randomlySelectedItems;
}

How do I have to draw the associations of this class? Should I draw 3 separate associations with the same classes or just one but many multiplicities?

Thanks.

1

There are 1 best solutions below

2
AudioBubble On BEST ANSWER

You should draw three associations.

Multiplicities is for one member to define a collection (array, list...).

So here you have two with multiplicity 0..*.

Here are some tutorials:

UML association multiplicity

UML Class Relationships

UML Association vs Aggregation vs Composition

UML Class Diagrams Reference

UML Class Diagrams: Guidelines

Defining Classes and Class Relationships

UML Tutotrial

The Unified Modeling Language Reference Manual