attributesumlassociationsentity-relationshipclass-diagram

When to model a multivalued attribute as a class vs a class attribute?


Is there an authoritative guidance or a commonly accepted practice as to when it is better to model a property as an associated entity/class versus as a multi-valued attribute?

For example: a person can have multiple skills. Is there a recommended practice for deciding whether it is more suitable to model a Person class associated with a Skill class or a Person class with a multivalued Skill attribute? Or would such a decision depend on the operations that can be performed or other factors?


Solution

  • The distinction in UML between an attribute, a property or an associated class is very thin and subtle:

    UML specifications (9.9.17): A Property is a StructuralFeature. A Property related by ownedAttribute to a Classifier (other than an association) represents an attribute and might also represent an association end. It relates an instance of the Classifier to a value or set of values of the type of the attribute.

    In the end, the choice is yours. But there is an unofficial rule of thumb that can help: