ENGIMY.IO - CHEATSHEET
UML × QUICK REFERENCE
REFERENCE vUML 2.x

UML Diagrams Quick Reference

Everything you need day‑to‑day – structural, behavioural, and relationship notation.

What is UML?

  • UML – Unified Modeling Language
  • Standard notation for visualising software design
  • 2 main categories: Structural (static) and Behavioural (dynamic)
  • Used for communication, documentation, and design

UML Diagram Types

Structural Diagrams

  • Class Diagram – classes, attributes, methods, relationships
  • Object Diagram – instances of classes at a moment in time
  • Component Diagram – components and their dependencies
  • Deployment Diagram – physical deployment of software
  • Package Diagram – grouping of elements into packages
  • Composite Structure – internal structure of a class
  • Profile Diagram – custom extensions

Behavioural Diagrams

  • Use Case Diagram – actors and system functionality
  • Sequence Diagram – interactions over time (lifelines)
  • Activity Diagram – workflows and processes
  • State Machine Diagram – states and transitions
  • Communication Diagram – interactions (collaboration)
  • Interaction Overview – high‑level sequence/activity
  • Timing Diagram – time‑based behaviour

Class Diagram

Class Notation

+---------------------+
|      ClassName      |
+---------------------+
| - attribute1: type  |
| + attribute2: type  |
+---------------------+
| + method1(): type   |
| - method2(): void   |
+---------------------+

// Visibility symbols
+  public
-  private
#  protected
~  package (default)

Relationships

Relationship Symbol Description Example
Inheritance ────▷ Is‑a (generalisation) Dog extends Animal
Realisation ┄┄┄▷ Implements interface Car implements Vehicle
Association ────► Has‑a (uses) Student attends Course
Aggregation ────◇ Has‑a (weak, shared) Team has Players
Composition ────◆ Has‑a (strong, owns) House owns Rooms
Dependency ┄┄┄► Uses (temporary) OrderService uses Database

Multiplicity

  • 1 – exactly one
  • * – zero or more
  • 0..1 – zero or one
  • 1..* – one or more
  • 0..* – zero or more (same as *)
  • n..m – between n and m

Use Case Diagram

Components

  • Actor – stick figure (user, external system)
  • Use Case – ellipse (system functionality)
  • System Boundary – rectangle (system scope)
  • Relationships: Include, Extend, Generalisation

Relationships

  • Include – mandatorily includes another use case (<>)
  • Extend – optionally extends another use case (<>)
  • Generalisation – inheritance between use cases

Sequence Diagram

Components

  • Lifeline – vertical dashed line (object over time)
  • Activation – rectangle on lifeline (execution)
  • Message – arrow between lifelines (method calls)
  • Return – dashed arrow (return value)
  • Self‑Call – arrow looping back to itself

Message Types

  • Synchronous – solid arrowhead (call)
  • Asynchronous – open arrowhead (signal)
  • Return – dashed arrow (return)
  • Self – arrow to itself

Fragments

  • alt – alternative (if/else)
  • opt – optional (if)
  • loop – iteration (for/while)
  • par – parallel
  • ref – reference to another sequence diagram
  • critical – atomic region
  • assert – assertion
  • neg – negative scenario

Activity Diagram

Components

  • Start Node – solid circle
  • End Node – solid circle with border
  • Activity – rounded rectangle
  • Decision – diamond (if/else)
  • Merge – diamond (join)
  • Fork – bar (parallel split)
  • Join – bar (parallel merge)
  • Swimlane – vertical/horizontal partition
  • Object Node – rectangle (data)
  • Signal – sending/receiving signals

State Machine Diagram

Components

  • State – rounded rectangle
  • Initial State – solid circle
  • Final State – solid circle with border
  • Transition – arrow with event/guard
  • Event – trigger (e.g., click, timeout)
  • Guard – condition (e.g., [x > 0])
  • Action – entry/exit/do activities
  • Choice – diamond (dynamic decision)

State Types

  • Simple – basic state
  • Composite – nested states (sub‑states)
  • History – remembers last sub‑state (H*)
  • Deep History – remembers deepest sub‑state (H*)

Component Diagram

Components

  • Component – rectangle with <> or icon
  • Interface – circle or rectangle with <>
  • Provided Interface – circle (lollipop)
  • Required Interface – socket (half‑circle)
  • Port – small square on component boundary

Deployment Diagram

Components

  • Node – 3D box (hardware, server)
  • Artifact – rectangle with <> (file, jar, war)
  • Deployment – arrow (deploy artifact to node)
  • Communication Path – line between nodes
  • Execution Environment – node with stereotypes (OS, container)

Communication Diagram

  • Same as sequence diagram but focuses on structure (how objects are connected)
  • Links between objects (associations)
  • Messages numbered sequentially (1, 2, 3... or 1.1, 1.2...)
  • Good for understanding object relationships

Timing Diagram

  • Shows state changes over time (X‑axis = time)
  • Lifeline with state changes (horizontal lines)
  • Time ticks, events, constraints
  • Useful for real‑time and embedded systems

UML Tools

Free / Open Source
  • PlantUML – text‑based, CLI (recommended)
  • Draw.io – web‑based, free
  • StarUML – free, powerful
  • Diagram (Mermaid) – text‑based, GitHub
Paid / Enterprise
  • Visual Paradigm – comprehensive, enterprise
  • Enterprise Architect – full suite
  • Lucidchart – web‑based, collaborative
  • Microsoft Visio – general‑purpose diagramming

PlantUML Example

@startuml
class Animal {
    - name: String
    + speak(): void
}

class Dog extends Animal {
    + speak(): void
}

interface Vehicle {
    + start(): void
}

class Car implements Vehicle {
    + start(): void
}

Car "1" --> "1" Engine
Class "1" --> "*" Student
@enduml

Mermaid Example

// Sequence diagram (GitHub Markdown)
sequenceDiagram
    Alice->>Bob: Hello Bob
    Bob-->>Alice: Hi Alice
    Alice->>Bob: How are you?
    Bob-->>Alice: I'm fine

Best Practices

  • Keep diagrams simple – focus on key elements.
  • Use consistent notation – follow UML standards.
  • Use meaningful names – classes, methods, attributes.
  • Hide irrelevant details – show only what's needed.
  • Use stereotypes – <>, <>, <>.
  • Use multiplicity – define cardinalities.
  • Use notes – for explanations and constraints.
  • Version control – store diagrams in Git (PlantUML, Mermaid).
  • Use tooling – automate diagram generation from code.
📌 Quick Reference
Structural: Class, Object, Component, Deployment, Package
Behavioural: Use Case, Sequence, Activity, State Machine, Communication
Relationships: Inheritance (─▷), Realisation (┄▷), Association (─►), Aggregation (─◇), Composition (─◆), Dependency (┄►)
Visibility: + (public), - (private), # (protected), ~ (package)
Multiplicity: 1, *, 0..1, 1..*, 0..*, n..m
Sequence fragments: alt, opt, loop, par, ref
Tools: PlantUML (text), Draw.io, StarUML, Mermaid, Visual Paradigm
← Back to All Cheatsheets