Modelling Domain Concepts and Their Relationships
Software Domain Modelling gives you a precise picture of the subject area a software system concerns. A domain model represents relevant concepts, their properties, their relationships and the rules governing them. For a lending service, that picture includes members, physical copies and borrowing events. It provides a shared vocabulary for reasoning about valid situations before choosing classes in code, database tables or screen layouts.
Choose concepts by their meaning
Begin with the model's purpose and boundary. A model of borrowing needs enough detail to distinguish who borrowed which physical item and when. It need not describe every activity of the organisation.
Look for things that need separate identities, descriptive values and meaningful connections. Two physical copies of the same book remain different items even when their titles match. Conversely, a member's name can usually be represented as a value belonging to that member within this model's scope.
Modelling choice | Lending example | Reason for including it |
|---|---|---|
Separate concept | BookCopy | Individual physical items must remain distinguishable |
Attribute | Loan.startDate | The date describes a particular borrowing event |
Association | Member has Loan | The connection identifies the borrower |
Constraint | At most one active loan per copy | The rule excludes conflicting current loans |
Concept selection depends on purpose. An address might be a simple value in one model and a separately identified location in another. Choose representations from the domain's meaning, rather than assuming every noun becomes a class.
Read relationships in both directions
A multiplicity specifies the permitted number of associated instances at one end of a relationship for one instance at the opposite end. In UML notation, 1 means exactly one, 0..1 means zero or one, and 0..∗ means zero or more with no specified upper bound.
Start with one Loan. The 1 beside Member says that loan has exactly one borrower. Now start with one Member. The 0..∗ beside Loan allows that member to have no retained loans or many. Read the BookCopy relationship in the same way.
Multiplicities also support counting checks. If there are n instances on one side, each participating in between ℓ and u links, the total number of links R satisfies:
Use the upper inequality when u is finite. Count the same links from the other side and apply both sets of bounds together. These bounds are necessary checks; additional rules may further restrict which arrangements are possible.
State rules and time scope explicitly
A diagram's endpoint bounds do not express every domain rule. A rule that holds in every permitted model state is often called an invariant. For example, a due date must not precede its loan's start date.
Time scope matters particularly when records are retained. A BookCopy may have many loans across its history while having at most one active loan now. Setting its total loan multiplicity to 0..1 would prevent the model from representing repeated borrowing.
Check a model with small, concrete situations: a new member with no loans, a returned copy borrowed again, or two different copies with the same title. Ask whether each legitimate situation can be represented and whether prohibited situations are excluded. Apply every bound to its stated population and time scope.
What to remember
- Model relevant domain meaning and distinguish instances that need separate identities.
- Read each multiplicity from one instance at the opposite end.
- Count links consistently from both sides.
- Record constraints that the diagram alone cannot express, including rules about active records.
Example: A Tool Library's Borrowing Model
A campus tool library lends individually tagged physical tools to registered members. Several physical tools can share one tool type, such as a particular drill model. Each physical tool belongs to exactly one type, and a type can remain listed even when the library owns no copies.
The library keeps every borrowing record, including its start date, due date and whether it has been closed. Each record concerns one member and one physical tool. A member can borrow the same tool again after returning it.
At any instant, each member may have at most 3 active loans, and each physical tool may have at most 1 active loan. There are currently 9 registered members and 13 physical tools. All tools are available, and every member is eligible to borrow any tool.
a) Identify the concepts needed to distinguish tool descriptions, individual tools and repeated borrowing events. Give suitable attributes.
A ToolCopy represents one physical item and carries its unique assetTag. ToolType represents the shared product description and can carry a name or model designation. Two copies can therefore have the same type while remaining distinct physical items.
Member represents a registered borrower and carries memberId. A Loan represents one borrowing event and carries startDate, dueDate and closed status. Its links identify the member and physical copy involved.
The four concepts are Member, ToolType, ToolCopy and Loan. Keeping Loan separate preserves repeated borrowing events, including events involving the same member and copy.
b) Specify the historical association multiplicities and the additional active-loan constraints.
Each Loan links to exactly one Member and exactly one ToolCopy. In the reverse directions, a Member can have zero or more retained Loans, and a ToolCopy can have zero or more retained Loans. Closed records remain part of these associations.
Each ToolCopy links to exactly one ToolType. A ToolType can have zero or more ToolCopies because a listed type need not currently have a physical copy.
Add two separate constraints: each member has at most 3 active Loans, and each copy has at most 1 active Loan. These restrictions concern active records at the same instant. Applying them to all retained records would incorrectly limit borrowing history.
The historical multiplicities are one participant per Loan and zero or more Loans per participant, with the active-only limits stated separately.
c) What is the maximum possible number of active loans at one instant? Show that your result is achievable.
First count the capacity allowed by the member rule. The 9 members, each permitted 3 active loans, provide a combined capacity of ________.
Next count from physical tools. Each of the 13 copies permits only one active loan, so the copy-side capacity is 13 active loans. Every active Loan uses both one member's allowance and one physical copy.
Check that 13 is achievable. Four members can hold ________ altogether by borrowing three distinct copies each. A fifth member can borrow the remaining copy. The other four members have no active loans, which the rules permit.
Every copy is borrowed once, and no member exceeds three active loans. Therefore, the maximum is 13 active loans. Adding the two capacities would count incompatible allowances rather than complete borrowing relationships.
A hotel team is preparing a domain glossary. Reception staff say reservation, while sales staff say booking. Investigation confirms that these names describe the same accommodation commitment: they share identifiers, lifecycle rules and business meaning.
The word account has two meanings. A guest account records a guest's charges and payments. A ledger account classifies financial entries. These have separate identifiers and business rules; neither represents the other.
Complete the modelling decisions using combine and distinguish, using each word once.
You should booking and reservation under one clearly defined domain concept, retaining both names in the glossary.
You should guest account from ledger account as separate domain concepts, using qualified names.
A museum retains every period during which an artwork was displayed in a gallery. The same artwork can return to the same gallery, and each visit has its own start and end dates. Which conceptual structure preserves every visit and its dates?