Domain analysis starts early in the development process to create a common understanding between the client and the developers of the scope and major entities that exist in a system.
A domain model, also known as a conceptual model, is (unsurprisingly) a conceptual model of the system, created by identifying the most important 'things' or entities present in the system. Such diagrams help teams develop a common understanding of the application problem space and the domain within which the system is working.
Domain models are conversational in nature and do not attempt to represent an exhaustive specification of the system. While they do not display anything directly related to how the system should be written in code, they can be useful as a starting point for thinking about the classes and objects necessary.
Domain analysis and modeling may continue to evolve throughout the project as the team learns more about the project.
- Working on the project gives you a different understanding of the domain.
- New features change your understanding of the domain
- When user stories are refined, during Backlog Grooming, more details may come out about the domain
- an up-to-date domain model can help maintain a common understanding between the development team and Product Owners
Use in Agile methodologies
In Agile development processes, which favor implementation over documentation, system specification documents such as domain models are created on an as-needed basis, and are created and updated whenever that is useful, often at the start of a project and on an as-needed basis during Sprint planning.
Identifying domain entities
Identifying the entities in a conceptual model of a system typically can be done within a few hours by following a straightforward process:
- go through all existing documentation of the system, including any product vision statement, requirements, user stories, use cases, and underline or write down all the nouns
- remove redundancy from this list of nouns - things that are represented by different words that represent the same thing can be consolidated and the vocabulary standardized
- identify any nouns that might be attributes or properties of other nouns
- If any attribute is not roughly equivalent to either a number or some text in the real world, then it is probably a conceptual class, not an attribute and should be its own entity.
- identify any associations between nouns
Create a diagram of these entities
After identifying the entities in the system, develop a simple diagram that represents these entities, including any important or interesting relationships among them.
- These diagram follow the UML conceptual class diagramming notation
- use rectangles around each noun
- write attribute names inside the rectangles, if useful
- draw lines connecting nouns that have interesting relationships between them
- write verbs that describe these relationships
- avoid generic verbs, like 'has', 'contains', or 'uses'
- indicate multiplicity of the entities in a relationship, if known
- multiplicity includes an upper and a lower bound indicating the number of each entity involved in the relationship
Note that domain modeling is similar but distinct from Entity Relationship Diagramming (ERD), which is used in relational database design. The two serve separate purposes.
Determining each class's responsibilities
In addition to identifying the conceptual entities and their relationships, it is also sometimes useful to determine what responsibilities each entity has. These can be added as additional notes to the domain model diagram.
Similar to how we analyze our specification for nouns in order to discover the entities, we analyze the specification for verbs to help identify the responsibilities, or behaviors, of each entity. This will ultimately be useful when thinking of our entities in terms of object types and their responsibilities as methods.
- Lynda.com - Programming Foundations: Object-oriented design - https://www.lynda.com/Java-tutorials/Foundations-Programming-Object-Oriented-Design/96949-2.html
- Lynda.com, Creating a conceptual model - https://www.lynda.com/Java-tutorials/Creating-conceptual-model/96949/106077-4.html
- Lynda.com, Identifying the classes - https://www.lynda.com/Java-tutorials/Identifying-classes/96949/106078-4.html
- Lynda.com, Identifying class relationships - https://www.lynda.com/Java-tutorials/Identifying-class-relationships/96949/106079-4.html
- YouTube - Domain model (perhaps too much info) - https://www.youtube.com/watch?v=kHCzG6okHos
- Software Engineering, 10th edition, by Ian Sommerville. Chapter 5 - System modeling
- Domain modeling abstact - http://www.scaledagileframework.com/domain-modeling/
- Domain model and domain modeling - http://stg-tud.github.io/eise/WS11-EiSE-07-Domain_Modeling.pdf
- Domain model: visualizing the concepts - http://csis.pace.edu/~marchese/CS616/Lec5/se_l5a.htm