Domain Modeling: Key Concepts and UML Representation
Domain Model and Cartographer Strategy
The construction of a Domain Model (DM) is compared to a cartographer’s strategy because of the following reasons:
- Existing Names: A DM should use the existing names within a territory. It utilizes the vocabulary of the domain, including conceptual classes and attributes.
- Relevance: A cartographer removes elements from a map if they are not considered relevant to the map’s purpose. Similarly, a DM may exclude conceptual classes from the problem domain that are not relevant to the requirements.
- Accuracy: A DM, like a map, should not include things that are not found in the problem domain being studied.
Attributes vs. Conceptual Classes
Rule of thumb: If a conceptual class X is a number or text in the real world, X is likely a conceptual class, not an attribute. If in doubt, consider it a separate item. Attributes should be relatively rare in a DM.
Class Specification or Description
A class specification (or description) is a conceptual class that gathers information about another class (Class A). It is not an instance of Class A but a description of information *about* Class A. For example, if “Glass” is a conceptual class, its class specification might be “GlassDescription”.
Necessity of Describing Conceptual Classes
It is necessary to describe conceptual classes because the description provides details *about* the class, which is distinct from the class itself.
When to Use Conceptual Class Specifications
Conceptual class specifications should be added if:
- A description of an item or service is needed, independent of the actual existence of any instance.
- The deletion of class instances would result in a loss of data that needs to be maintained.
- It reduces redundant or duplicate information.
UML and Domain Models
The Unified Process (UP) defines something represented by UML. However, there isn’t a specific term “Domain Model” in the official UML documentation. UML describes diagrams as class diagrams and sequence diagrams, not as a modeling method. The application of UML notation is defined within the context of a methodology.
Domain Model in the Software Development Process
The DM is created during the Business Modeling discipline, in the preparation phase.
Associations in UML
An association is a relationship between types that indicates a meaningful and interesting connection. In UML, associations are defined as semantic relationships between two or more classifications that involve connections among their instances.
Relevant Associations
Associations worth recording include:
- Associations where knowledge of the relationship needs to be preserved.
- Associations derived from the common associations list.
The reading direction arrow indicates the direction for reading the association’s name. It does *not* indicate visibility or navigation. It’s purely an aid for the reader.
High-Priority Associations
High-priority associations include:
- A is a physical or logical part of B.
- A is physically or logically contained in B.
- A is recorded in B.
Conceptual Classes vs. Association Classes
Identifying conceptual classes is more important than identifying association classes.
Excessive Associations
Too many associations can confuse a DM rather than clarify it. Their discovery can be time-consuming with marginal benefit.
Roles in Associations
Each end of an association is called a role. Roles may optionally have:
- Name
- Multiplicity expression
- Navigability