Modelling and the three models
How to create and move between the three software models used in object-oriented development: the conceptual (domain) model, the analysis/specification model, and the design/implementation model, with rules and examples for exam use.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Model-based thinking organises software work. Engineers use models to record what a system is, what it must do, and how it will be built: the three models separate concerns so teams can analyse the problem, specify behaviour, and design an implementation with traceability between them.
Key ideas
Start with definitions (each bolded term is defined the first time it appears).
- Model: a simplified, explicit representation of part of reality used to reason about that part. A model abstracts away unneeded detail and keeps what matters for a purpose.
- Modelling: the activity of creating models: selecting concepts, relationships, constraints and behaviour relevant to a stakeholder purpose.
- Conceptual model (domain model): a model of the problem domain that records the important domain concepts and their relationships, using domain terms (no programming or design constructs). It states nouns, facts and domain constraints. It is purely about the real world the system will serve.
- Specification (analysis) model: a model that refines the conceptual model by adding precise behaviour, responsibilities, operations, pre/post-conditions and interfaces but still avoids platform-specific implementation choices. It may use use cases, sequence diagrams, and class diagrams with operations.
- Design (implementation) model: a model that maps specification elements to software constructs and platform details: classes with visibility, data structures, design patterns, modules, packages, component and deployment details. It is ready to be implemented in code.
Three-model principle (exact statement):
- The development of an object-oriented system can be divided into three logically distinct models: the Conceptual model, the Specification model, and the Design model. Each model must be consistent with the model above it (traceability) and can add detail but must not contradict higher-level intent.
Assumptions behind the three-model principle:
- The problem domain can be described independently of implementation technology.
- Analysis decisions (what the system must do) should be separated from design decisions (how the system will do it).
- Stakeholders need different representations: domain experts prefer the conceptual model, analysts prefer the specification model, and implementers prefer the design model.
Constraints / consistency rules (formal style):
(Traceability Rule) For every element e in the Specification model there exists at least one origin o in the Conceptual model such that e refines o. For every element d in the Design model there exists at least one origin s in the Specification model such that d implements s.
(Non-contradiction Rule) If the Conceptual model states a domain invariant I, then neither the Specification nor the Design model may contain behaviour that violates I, unless the invariant is explicitly relaxed with stakeholder agreement.
How to construct and move between models (derivation steps often asked in exams):
- From requirements/use cases derive domain vocabulary: list nouns, verbs and important facts. Draw a box with the domain name and write key terms.
- Build the Conceptual model: create classes for important nouns (domain concepts). For each class add attributes that are domain facts and draw binary associations between classes with named roles and multiplicities (cardinalities). Label any domain invariants.
- Move to the Specification model: for each conceptual class decide which responsibilities become operations; add method signatures with parameters and postconditions; define key interactions using sequence diagrams or flow specifications; treat associations as abstract links with navigability when needed.
- Move to the Design model: choose data types for attributes, visibility (+, -, #), concrete collection types for multiplicities (e.g., list, set), map associations to references or foreign keys, apply patterns (e.g., factory, DAO) and partition into packages and components. Specify concurrency, persistence and error handling.
What to draw (exact diagram instructions for exams):
Conceptual class diagram: Draw UML class boxes without visibility markers. For each box, write class name in top compartment and domain attributes in second compartment without types (or with domain-type words like 'Money', 'Date'). Draw associations as solid lines labeled with role names near the class ends; write multiplicities near the ends (e.g. 1, 0.., 1..). Mark aggregations with open diamond and compositions with filled diamond only if the domain requires it.
Specification class diagram: Draw classes with attribute types and method signatures (operationName(parameters) : returnType). Indicate pre/post-conditions as notes attached to operations. When required, use OCL-style constraints (e.g., context, pre, post, inv) for precision. Add sequence diagrams: draw vertical lifelines for participating objects, show messages as horizontal arrows labelled with operation names, and number messages for order.
Design class diagram: Use full UML: visibility at front of attributes and operations, concrete types (int, String), stereotypes (<<interface>>, <<entity>>), dependency arrows for implementation ties, and packages. Add component or deployment diagrams to show runtime mapping.
Relation to other topics: Conceptual modelling feeds Class modelling and Generalisation; the Specification model links to State modelling, Use case models and Sequence models; the Design model connects to System design decisions, Architectural styles and Implementation modelling.
Formulas
(for modelling topics, remember these syntaxes and small rules)
ClassBox ::= Name | Name\nAttributes | Name\nAttributes\nOperations - how to split a UML class box into compartments; use Name in top, Attributes second, Operations third.
association: ClassA "roleA" [multiplicity] — "roleB" [multiplicity] ClassB - draw a solid line; multiplicities like 1, 0..1, 0.., 1...
generalisation: Subclass --|> Superclass - open triangle arrow from subclass to superclass.
aggregation: Container <>— Member - open diamond at container end for aggregation.
composition: Container <filledDiamond>— Member - filled diamond at container end for composition (strong ownership).
Java class: public class Name { private Type attr; public ReturnType op(Params) { ... } } - basic mapping for a UML class to Java.
interface syntax: public interface Name { ReturnType op(Params); } - implement with 'implements'.
multiplicity mapping: 1 -> single reference; 0..1 -> Optional<T> or a nullable reference (depending on language policy); 0..* -> java.util.List or Set; 1..* -> choose collection and enforce non-empty in constructor.
Worked examples
Example 1 — Model answer: Conceptual and Specification models for a small library lending system.
Problem statement (short exam form): Model the domain of a library where members borrow books. Each book has one or more copies; a member can borrow up to 5 copies. Show the conceptual model and one specification-level operation to borrow a book.
Solution (step-by-step answer you should write in an exam):
- Domain vocabulary: nouns: Book, Copy, Member, Loan, Librarian. Facts: a Book has many Copies; a Member may have Loans; a Loan links a Member to a Copy with dates.
- Draw the Conceptual class diagram: draw class boxes for Book, Copy, Member, Loan. For each box write domain attributes: Book: title, author; Copy: barcode; Member: name, memberId; Loan: loanDate, dueDate. Draw associations: Book 1 — 0..* Copy (role 'copies'); Member 1 — 0..* Loan (role 'loans'); Copy 0..* — 1 Loan. Label multiplicities exactly (each Loan links exactly one Member and exactly one Copy). (This description is what to draw.)
- State any invariants: Member.borrowedCount() <= 5; A Copy can be on at most one active Loan.
- Specification model: add operation in Member:
borrow(copy: Copy) : Loanwith precondition:copy.isAvailable() = true and borrowedCount() < 5. Postcondition:a new Loan exists linking this Member and copy with loanDate = todayandcopy.status = LOANED.
This answer shows you created the conceptual model and then gave a specification operation with pre/post conditions and invariants. Draw the sequence: Caller -> Member.borrow(copy) -> new Loan(member, copy, today, due) -> Copy.setStatus(LOANED). Number the messages.
Example 2 — Mapping a specification to Java (short trace)
Given the specification operation borrow(copy: Copy) : Loan, design mapping steps and a short Java class snippet.
- Decide class visibility and types: Member -> class Member { private String memberId; private List<Loan> loans; }
- Map multiplicities: loans:
0..*->List<Loan> loans = new ArrayList<>(); - Implement operation (show code skeleton):
public Loan borrow(Copy copy) { if (!copy.isAvailable()) throw new IllegalStateException(); if (loans.size() >= 5) throw new IllegalStateException(); Loan loan = new Loan(this, copy, LocalDate.now(), LocalDate.now().plusWeeks(2)); loans.add(loan); copy.setStatus(Status.LOANED); return loan; }
Explain what to draw: in the design class diagram now show +borrow(copy: Copy): Loan with visibility and types; show dependency from Member to Loan and to Copy.
Common mistakes
- Not writing pre/post-conditions for specification operations where asked.
- Violating invariants in lower models (design that allows borrowedCount > limit).
- Mapping 1-to-many associations to a single reference (should use a collection) or using the wrong collection semantics (List vs Set) without justification.
- Using composition when aggregation is correct for the domain: composition implies strong lifecycle dependence.
For your exam
Kinds of questions you will see:
- Definitions and short notes: define the three models and say their purposes. A full-marks answer gives precise definitions, assumptions and an example of when to use each model.
- Diagrams: draw a conceptual class diagram from a short problem description. Full marks require correct classes, attributes, associations with multiplicities and labelled roles.
- Derivations: show step-by-step how to go from conceptual to specification, or from specification to design. Full marks include traceability and show invariants preserved.
- Programs / code mapping: translate a design class to Java. Full answer shows visibility, types, collection choices for multiplicities and a short method implementation consistent with specification.
- Sequence/state questions: create a sequence diagram showing an operation's messages and order. Full marks include lifelines, message arrows, return values and ordering numbers.
How to structure full-marks answers: state assumptions, list domain vocabulary, draw the requested diagram(s) clearly with labels and multiplicities, write key invariants and any pre/post-conditions, and if mapping to design, show concrete types and brief code.
Quick check
- Name the three models and one stakeholder who prefers each.
- How do you map an association with multiplicity 0..* to Java?
- What is a correct precondition for a borrow operation in a library system where the limit is 5 loans per member?
Answers: Conceptual (domain expert), Specification/Analysis (analyst), Design/Implementation (developer); 0..* -> a collection such as List<...> or Set<...> with code to maintain membership; precondition: copy.isAvailable() = true and member.loans.size() < 5.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?