Skip to content

Unit 4 — Modeling with UML

Learning objectives

  • Select an appropriate model for a question rather than diagramming everything.
  • Use use-case, class, sequence, state, and component views appropriately.
  • Keep models consistent with implementation and decisions.

Models are purposeful abstractions

A model omits details to emphasize a concern. Ask what question the diagram should answer before choosing a notation.

Question Useful view
Who interacts with the system and for what goal? Use-case/context view
What are key domain concepts and relationships? Domain/class model
How do components collaborate for a scenario? Sequence diagram
How does an entity change state? State machine
What are the major deployable/runtime parts? Component/deployment view

Example sequence

sequenceDiagram
    actor User
    participant UI
    participant Service
    participant DB
    User->>UI: Submit request
    UI->>Service: validate(command)
    Service->>DB: load state
    DB-->>Service: state
    Service-->>UI: result
    UI-->>User: feedback

Modeling guideline

Prefer a small set of living diagrams linked to important decisions over a large document that immediately becomes stale.