UML Domain Model

A domain model is used to capture the generic knowledge in a particular area (domain). A domain model is to reflect this domain and is not about software.

A domain model is documented using a subset of the UML class diagram notation. I.e. the notation for domain models are not as detailed as for a design model.

Class

In a domain model a class only contains a name and attributes, operations are not used in domain modeling.

UML Domain Model Class

Association

The primary relation between classes in a domain model. If the requirements indicate that a more or less persistent (time independent) link needs to exist between two objects, then there should likely be an association between the classes.

Domain model associations have a descriptive association name, and multiplicities, the association does not have any navigability.

This example shows that a student can attend several courses, and a course can be attended by several students. However, we cannot say e.g. when a student attended the course, just that a student has attended. Dependeing on the actual requirements this could be enough. UML Domain Model Associations

Association Class

In some cases there is a need to add information to an instance of an association. This can be modeled using associations and classes but there is also a special notation for this.

This example captures that a student can attend several courses and that a course can be attended by several students. This model adds information so that we can know when a student attended a course and the grade. The problem here is that it is visually messy to understand that a Student attends Courses. UML Domain Model Associations

This example does the same, but using a more elegant notation using an association class. UML Domain Model Association Class

Datatype Class

In some cases you may find yourself modeling a simplistic class that is used by many other classes. This would create a lot of associations that could make it impossible to read the model visually. you may then opt to use the class as a data type class. If so it is treated more like a primitive data type than a class. E.g. you use it as attributes and not associations.

Note that this is an exception and that it should not be abused, i.e. all classes are treated as data type classes and there are no association.

Generalization

In some cases it can be useful to be able to model hierarchies using generalisation. Typically only specific classes exist in the actual domain. E.g. in reality you only find Apple, Pear, Banana in a model you may however choose to make an abstraction Fruit if it is suitable. Sub classes can then be used to either examplify what the abstraction means, add aditional data, or indicate that there is some difference in behavior between the more specific classes.

UML Domain Model Class

Composition and Aggregation

The composition can be used to describe a physical whole part relation. Aggregation is typically not used in a domain model.

Dependency and Realziation

These relations are typically not used in a domain model.