Skip to content

Chapter 6: Model-Based Documentation

Exam weight: This is the heaviest part of the ~40% documentation block. Expect many questions on UML diagram types, notation, and interpretation.

Why Use Models?

Models complement natural language by providing:

  • Precision — formal notation reduces ambiguity
  • Abstraction — focus on relevant aspects, hide details
  • Different perspectives — structure, behavior, interaction
  • Communication — visual representations are easier to discuss

Models don't replace natural language — they supplement it. Use natural language for context, rationale, and details that models can't express. Use models for structure and behavior that text describes poorly.

Overview of Model Types

Model TypePurposeShows
Use case diagramFunctional overviewWhat the system does for its actors
Activity diagramProcess/workflowStep-by-step flow with decisions and parallelism
State machine diagramObject lifecycleHow an entity changes state over time
Class diagramData structureEntities, attributes, and relationships
Goal modelMotivationWhy requirements exist, stakeholder goals

Use Case Diagrams

Use case diagrams show what the system does from the user's perspective — a high-level functional overview.

Elements

ElementSymbolMeaning
ActorStick figureA person or external system interacting with the SuD
Use caseOval/ellipseA function the system provides
System boundaryRectangleThe boundary of the SuD
AssociationSolid lineAn actor participates in a use case
mermaid
graph LR
    subgraph Online Shop - SuD
        UC1((Browse\nProducts))
        UC2((Place\nOrder))
    end
    Customer -->|uses| UC1
    Customer -->|uses| UC2

Relationships Between Use Cases

Include (<<include>>)

The base use case always executes the included use case.

mermaid
graph LR
    PO((Place Order)) -- "«include»" --> VP((Verify Payment))

"Place Order" always includes "Verify Payment" — you can't place an order without payment verification.

Extend (<<extend>>)

The extending use case optionally adds behavior to the base use case.

mermaid
graph RL
    AC((Apply Coupon)) -- "«extend»" --> PO((Place Order))

"Apply Coupon" optionally extends "Place Order" — the customer may or may not have a coupon.

Actor Generalization

One actor inherits the use cases of another.

mermaid
graph BT
    Admin -->|inherits| User

Admin is a specialized User — Admin can do everything a User can, plus admin-specific functions.

Key Exam Distinction

Include = always, mandatory. Extend = optional, conditional. The arrow directions are different: include points FROM base TO included; extend points FROM extending TO base.

Use Case Description (Textual)

A use case diagram gives an overview but not details. Each use case should have a textual description:

FieldContent
IDUC-03
NamePlace Order
ActorCustomer
PreconditionCustomer is logged in and has items in cart
Main flow1. Customer selects "Checkout" 2. System displays order summary 3. Customer confirms order 4. System processes payment 5. System confirms order
Alternative flows3a. Customer modifies quantity → return to step 2
Exception flows4a. Payment fails → System displays error, return to step 3
PostconditionOrder is recorded; confirmation email sent

Activity Diagrams

Activity diagrams model processes and workflows — the step-by-step flow of activities with decisions and parallelism.

Elements

ElementSymbolMeaning
Initial nodeFilled circle ●Start of the process
Activity/ActionRounded rectangleA step in the process
DecisionDiamond ◇Branch point (one path taken)
MergeDiamond ◇Reconnects decision branches
ForkThick bar ━Splits into parallel paths
JoinThick bar ━Synchronizes parallel paths
Final nodeCircle with inner filled circle ◉End of the process
Swim laneVertical/horizontal partitionAssigns activities to responsible actors

Example: Order Processing

mermaid
flowchart TD
    Start(( )) --> Receive[Receive Order]
    Receive --> Check{Stock available?}
    Check -->|Yes| Fork1[ ]
    Check -->|No| Notify[Notify Customer]
    Notify --> End1(( ))
    Fork1 --> Pack[Pack Items]
    Fork1 --> Invoice[Send Invoice]
    Pack --> Join1[ ]
    Invoice --> Join1
    Join1 --> Ship[Ship Order]
    Ship --> End2(( ))

Swim Lanes

Swim lanes partition activities by responsibility — who performs each step.

mermaid
flowchart LR
    subgraph Customer
        A[Submit Order]
        F[Receive Email]
    end
    subgraph System
        B[Validate Order]
        E[Send Confirmation Email]
    end
    subgraph Warehouse
        C[Pick Items]
        D[Pack & Ship]
    end

    A --> B --> C --> D
    B --> E --> F

From Your Experience

As a tester, activity diagrams map directly to test scenarios — each path through the diagram is a test case. As a BA, swim lanes help you assign responsibilities to roles.

State Machine Diagrams

State machine diagrams show how an entity changes state in response to events over its lifecycle.

Elements

ElementSymbolMeaning
StateRounded rectangleA condition the entity is in
TransitionArrow →Change from one state to another
EventLabel on transitionWhat triggers the transition
Guard[condition]Condition that must be true for transition
Action/actionWhat happens during the transition
Initial stateFilled circle ●Starting state
Final stateEnd of lifecycle

Transition Syntax

event [guard] / action

Example: Order Lifecycle

mermaid
stateDiagram-v2
    [*] --> New
    New --> Confirmed : payment received
    New --> Cancelled : cancelled
    Confirmed --> Shipped : shipped
    Shipped --> Delivered : delivered
    Cancelled --> [*]
    Delivered --> [*]

With guard conditions:

mermaid
stateDiagram-v2
    Delivered --> Returned : return requested [within 30 days] / create return label
Exam tip: Be able to read transition labels in the format event [guard] / action. Questions often ask what event triggers a specific transition or what guard condition applies.

Class Diagrams (Data Models)

Class diagrams model the data structure of the domain — what entities exist, their attributes, and how they relate to each other.

Elements

ElementMeaning
ClassA domain entity (rectangle with name, attributes, operations)
AssociationA relationship between classes (line)
MultiplicityHow many instances participate (numbers at ends of association)
GeneralizationInheritance (triangle arrow pointing to parent)
Aggregation"Has-a" relationship, parts can exist independently (hollow diamond)
Composition"Has-a" relationship, parts cannot exist without the whole (filled diamond)

Multiplicity Notation

NotationMeaning
1Exactly one
0..1Zero or one (optional)
* or 0..*Zero or more
1..*One or more (at least one)
2..5Between 2 and 5

Example: E-Commerce Domain Model

mermaid
classDiagram
    Customer "1" --> "0..*" Order : places
    Order "1" --> "1..*" OrderItem : contains
    OrderItem "0..*" --> "1" Product : refers to

    class Customer {
        name
        email
        address
    }
    class Order {
        orderDate
        status
        totalAmount
    }
    class OrderItem {
        quantity
        unitPrice
    }
    class Product {
        name
        description
        price
    }

Reading: "One Customer places zero or more Orders. Each Order contains one or more OrderItems. Each OrderItem refers to one Product."

Generalization (Inheritance)

mermaid
classDiagram
    Payment <|-- CreditCard
    Payment <|-- BankTransfer

    class Payment {
        amount
        date
    }
    class CreditCard {
        cardNumber
        expiry
    }
    class BankTransfer {
        accountNumber
        bankCode
    }

CreditCard and BankTransfer are specialized types of Payment — they inherit amount and date.

Aggregation vs. Composition

mermaid
classDiagram
    Department o-- Employee : aggregation
    Order2 *-- OrderItem2 : composition

    class Department { }
    class Employee { }
    class Order2["Order"] { }
    class OrderItem2["OrderItem"] { }

Key Exam Distinction

Aggregation (hollow diamond): the part can exist independently of the whole. Composition (filled diamond): the part cannot exist without the whole — if the whole is deleted, the parts are deleted too.

Goal Models

Goal models capture the why behind requirements — what stakeholders want to achieve.

Goals are decomposed into sub-goals, which eventually lead to concrete requirements.

mermaid
graph TD
    G1[Increase online sales]
    G1 --> G2[Improve user experience]
    G1 --> G3[Reduce cart abandonment]
    G2 --> R1["Fast page loads (< 2 sec)"]
    G3 --> R2["Simplified checkout (3 steps)"]

Goal models help:

  • Justify requirements — every requirement traces back to a business goal
  • Prioritize — requirements supporting high-priority goals get higher priority
  • Detect conflicts — conflicting goals produce conflicting requirements

Choosing the Right Model

If you need to show...Use...
What the system does for usersUse case diagram
How a process flows step by stepActivity diagram
How an entity's state changes over timeState machine diagram
The data structure and relationshipsClass diagram
Why requirements existGoal model

Practice Quiz

Practice Quiz

Q1. What is the primary advantage of model-based documentation over pure natural language?

AModels are always more complete than text
BModels reduce ambiguity for structural and behavioral aspects
CModels do not require any training to read
DModels replace the need for natural language documentation

Q2. In a use case diagram, what does an "include" relationship mean?

AThe included use case optionally extends the base use case
BThe base use case always incorporates the behavior of the included use case
CThe included use case replaces the base use case
DThe included use case is an alternative to the base use case

Q3. In an activity diagram, what does a fork (thick horizontal bar splitting into multiple paths) represent?

AA decision point where only one path is taken
BThe start of parallel activities that execute concurrently
CThe end of the activity
DAn error handling branch

Q4. In a state machine diagram, what triggers a transition between states?

AA class association
BAn event, optionally with a guard condition
CA use case include relationship
DA data flow between entities

Q5. In a class diagram, what does a multiplicity of "0..*" on an association mean?

AExactly zero instances
BZero or more instances (optional, unbounded)
CAt least one instance
DExactly one instance

Q6. Which diagram type is MOST suitable for documenting the data structure and relationships in a domain?

AActivity diagram
BState machine diagram
CClass diagram / data model
DUse case diagram

Q7. What does an "extend" relationship in a use case diagram represent?

AA mandatory behavior that is always executed
BAn optional behavior that extends the base use case under certain conditions
CInheritance between two actors
DA data flow between use cases

Previous: ← Chapter 5: Natural Language | Next: Chapter 7: Validation & Negotiation →

Study guide for IREB CPRE Foundation Level exam preparation.