-
Notifications
You must be signed in to change notification settings - Fork 17
Class or data type
Conceptual classes in UML models may represent physical objects like rivers, roads or buildings, but also more abstract objects like organisations, transactions or observations. Identifying conceptual classes is the first and probably the most important step of domain modeling.
A data type is a special kind of classifier, similar to a class. It differs from a class in that instances of a data type are identified only by their value. In other words - it does not exist as identifiable instances of its own, only as values for one or more attributes (or associations). Data types are typically used when it is not meaningful with unique identification of a single value (or a set of values).
The question will often arise whether something is a class (feature type in ISO/TC211 application schemas) or an attribute with a data type. There is no strict answer to this, but a basic rule in UML modeling is to keep the model and the implementation of the model as simple as possible. And remember that the values of a data type will not exist on its own, only as values on the related class. Indiscriminate use of complex data types will increase the amount of data within an instance of a class. For example in GML: While one may use xlink:href for associations to a class, associations to data types will always be inline, since the data type instance does not exist outside of the main object.
Therefore, it is preferred to use feature types above data type. Follow this basic rule:
In cases of doubt - use classes instead of data types
See also this article on attributes and associations.