Search code examples
attributesumlclass-diagrammodel-associations

Use Association or List attribute in UML Class diagram?


I have identified two classes that I want to implement in code like this:

InsuranceProviders{ 
}

Advice{
    List<InsuranceProviders> providers;
}

If I wanted to represent these two classes in a UML class diagram, should the Advice class have an Association with InsuranceProvider, or should it have a list attribute of InsuranceProvider instead?

With Association

With Attribute

Or maybe something else?


Solution

  • Unless it's a simple value attribute, like a number or a string, always use an association.