📐 CSS323 — Chapter 4: UML Diagrams Cheat Sheet
1. UML Diagram Taxonomy
UML Diagrams
├── Structure Diagrams
│ ├── Class
│ ├── Object
│ ├── Package
│ ├── Component ← covered in this chapter
│ ├── Composite Structure
│ └── Deployment ← covered in this chapter
├── Behavior Diagrams
│ ├── Use Case
│ ├── Activity ← covered in this chapter (most detail)
│ ├── State Machine ← covered in this chapter
│ └── Interaction
│ ├── Sequence
│ ├── Communication
│ ├── Interaction Overview
│ └── Timing
└── UML Extension
└── Profile Diagram
🔵 PART I — Activity Diagrams
2. What Is an Activity Diagram?
Specifies system behavior — shows how data and control flow through a process.
- Based on data flow models — a directed graph showing how data moves through a system
- Think of it as a flowchart on steroids: shows steps AND what data flows between them
🍎 Apple analogy: The "Share Photo" feature in iOS — Activity Diagram shows: tap Share → pick recipient → compress image → send → notify sent. Each step with data flowing between them.
3. Three Node Types (memorize these!)
| Node Type | Shape | Purpose | Example |
|---|
| Action Node | Rounded rectangle | Executable step — does one thing | "Compress Image" |
| Control Node | Various (see below) | Coordinates flow | Decision, Fork, Join |
| Object Node | Rectangle | Holds data temporarily between actions | Order [Pending] |
4. Control Nodes — All 6 Types
| Control Node | Shape | Behavior | Key Rule |
|---|
| Initial | ● filled circle | Starts the flow | Multiple initials → multiple parallel flows; one token per outgoing edge (no duplication) |
| Decision | ◇ diamond | Routes to ONE outgoing edge based on guard | Guards on edges; [else] = fallback if all others fail; token NOT duplicated |
| Merge | ◇ diamond | Brings multiple alternate flows together | No synchronization — passes immediately; does NOT wait |
| Fork | ━━ thick bar | Splits ONE flow into MULTIPLE parallel flows | Tokens ARE duplicated |
| Join | ━━ thick bar | Waits for ALL incoming flows, then continues | Synchronizes — must wait; can have {joinSpec} |
| Final — Activity | ⊙ circle-in-circle | Terminates when FIRST token arrives | Kills everything — intentional race |
| Final — Flow | ⊗ circle-with-X | Terminates only THIS branch | Just destroys tokens that arrive; others continue |
Decision vs. Merge — Easy Confusion ⚠️
Decision = one IN, many OUT (splits based on condition)
Merge = many IN, one OUT (combines alternate paths, no waiting)
Fork = one IN, many OUT (creates parallel flows, duplicates tokens)
Join = many IN, one OUT (synchronizes parallel flows, WAITS)
🍎 Apple analogy:
- Decision:
if photoSize > 10MB → compress vs. send directly
- Fork: simultaneously upload to iCloud AND send notification
- Join: wait for BOTH face detection AND location tagging to complete before saving
- Merge: whether user paid by card OR Apple Pay, both paths → "Show Receipt"
5. Edges — Two Types
| Edge Type | What Flows | Usage |
|---|
| Control Flow Edge | Control token | Starts next action after previous completes — plain arrow |
| Object Flow Edge | Object/data token | Passes data between object nodes — arrow with rectangle |
Edge Weight:
weight=n⇒minimum n tokens must traverse simultaneously
Example: Form Cricket Team {weight=11} — must have 11 players before the action fires.
6. Actions
The fundamental unit of executable functionality. Does one transformation.
- Creating objects
- Setting attribute values
- Linking objects together
- Invoking behaviors
| Pin Type | Description |
|---|
| Regular Pin | Input waits until action starts; output waits until passed downstream |
Streaming {STREAM} | Accepts/provides values WHILE action is executing |
| Exception Output △ | Triangle symbol — fires when action terminates with error; excludes all other outputs |
| Parameter Sets | Action accepts input from ONE set OR another, not both |
| ValuePin | Provides constant values to an action |
Action Start/End Rules:
- Can START when: all non-stream inputs have arrived (or ≥1 stream input if only streams exist)
- Can FINISH when: all inputs arrived + all non-stream/non-exception outputs provided (or an exception output)
- Deadlock prevention: ALL input pins must be ready simultaneously
7. Object Nodes — 4 Types
| Type | Description | Analogy |
|---|
| Pins | Input/output of specific actions | In-tray / out-tray on a desk |
| Activity Parameter Nodes | Receive/provide data to the whole activity | Function parameters |
Central Buffer «centralbuffer» | Buffer from multiple sources to multiple destinations; token goes to ONE destination only | Shared warehouse |
Datastore «datastore» | Persistent storage; tokens NEVER leave (only copies move out); new token replaces duplicate | Database table |
| Feature | Syntax | Meaning |
|---|
| Multiplicity | [min..max] | Min/max values accepted at each invocation |
| Upper Bound | {upperBound=n} | Max tokens node can hold; flow stops when full |
| Effect | {create} / {read} / {update} / {delete} | What action does to the object |
| Ordering | {ordering=FIFO} / LIFO | Order tokens offered to outgoing edges |
8. Special Activity Features
Partition (Swimlanes)
- Divides nodes/edges by organizational unit (department, role)
- Can be hierarchical and multidimensional
- Same as BPMN swimlanes
🍎 Apple example: Activity Diagram with swimlanes: Customer lane | iOS App lane | Server lane
Pre & Post Conditions
«precondition» constraint ← must be true BEFORE activity starts
«postcondition» constraint ← must be true AFTER activity ends
«localPrecondition» ← condition on a specific action
«localPostcondition» ← condition after a specific action
SendSignalAction (pentagon shape)
- Creates and sends a signal asynchronously — no reply expected
- Like sending a text — fire and forget
AcceptEventAction
- Accept event action (concave pentagon) — waits for a signal
- Wait time action (hourglass) — waits for a time event
- Relative:
after (5 seconds)
- Absolute:
Jan, 1, 2000, Noon
InterruptibleActivityRegion (dashed rounded rectangle + ⚡)
- When a token exits via interrupting edge → ALL tokens in region are terminated
- Like an emergency stop button
Exceptions
Protected Node ──[ExceptionType]──▶ Handler Body Node
- If not caught → propagates to enclosing protected node
- If reaches top level uncaught → behavior unspecified
- Transformation: tokens are converted as they traverse an edge (like a data converter)
- Selection: specifies order tokens are offered from object nodes; edge selection overrides node selection
9. Token Competition
- Object nodes cannot duplicate tokens (unlike Fork nodes)
- Multiple outgoing edges from one object node = competition — only one gets the token
- Results in indeterminacy — which path gets the token is not guaranteed
🟣 PART II — State Machine Diagram
10. What Is a State Machine Diagram?
Shows discrete behavior of an object through finite state transitions.
- Models the lifecycle of ONE object
- State = behavioral condition of an object at a point in time
- Two types: Simple state and Composite state (contains nested sub-states)
11. State Notation — All Elements
| Element | Symbol | Description |
|---|
| Start | ● filled circle | Initial pseudostate |
| End | ⊙ circle-in-circle | Final state |
| State | Rounded rectangle | Current condition of the object |
| Trigger | Arrow with label | Event that causes transition |
| Guard | [Condition] on arrow | Transition only fires if condition is true |
| Fork | ━━ thick bar (one in, many out) | Splits into concurrent regions |
| Join | ━━ thick bar (many in, one out) | Synchronizes concurrent regions |
| Composite State | Large rounded rect containing states | State containing nested sub-states |
State Internal Activities:
StateName
────────────────
entry / entryActivity ← runs when entering the state
do / doActivity ← runs continuously while in the state
exit / exitActivity ← runs when leaving the state
12. State Machine vs. Activity Diagram
| Activity Diagram | State Machine |
|---|
| Focus | System behavior / process flow | Object lifecycle / states |
| Nodes | Actions, Control nodes, Object nodes | States |
| Transitions | Edges (control/object flow) | Triggered transitions |
| Used for | Business processes, algorithms | Order status, ATM states, UI screens |
🍎 Apple examples:
- Activity: "How does App Store purchase work" → Activity Diagram
- State Machine: "What states does an AirPods connection go through" → Disconnected → Connecting → Connected → Paused → Disconnected
🟢 PART III — Component Diagram
13. What Is a Component Diagram?
Shows components, interfaces, ports, and relationships — used in Component-Based Development (CBD) and Service-Oriented Architecture (SOA).
- Each component = one clear responsibility
- Components interact on a need-to-know basis only
14. Component Stereotypes
| Stereotype | Meaning |
|---|
«executable» | Program that runs on a node |
«application» | Several executables |
«file» | Source code or data file |
«library» | Static or dynamic library |
«document» | Document |
«page» | HTML page |
«subsystem» | Sub-system |
15. Component Interfaces — Key Visual Symbols
| Interface | Symbol | Meaning |
|---|
| Provided Interface | 🍭 Ball (lollipop) | Services this component OFFERS to others |
| Required Interface | 🔌 Socket | Services this component NEEDS from others |
Provided = what you give (ball sticking out) Required = what you plug into (socket)
16. Two Connector Types
| Connector | Purpose |
|---|
| Delegation Connector | Links external port/interface to the internal realization of behavior |
| Assembly Connector | Connects a component's Required Interface to another component's Provided Interface (ball-and-socket join) |
🔴 PART IV — Deployment Diagram
17. What Is a Deployment Diagram?
Shows the physical hardware configuration and how software components are deployed on it.
- Models runtime processing elements
- Only components that exist at runtime appear here
- Used AFTER decisions on: subsystem decomposition, concurrency, hardware/software mapping
18. Key Deployment Diagram Elements
| Element | Symbol | Description |
|---|
Device Node «device» | 3D box | Physical hardware device |
Processor «processor» | 3D box | Processing hardware |
Execution Environment «executionEnvironment» | 3D box | Runtime environment (JVM, Docker, etc.) |
Artifact «artifact» | Document icon | Physical piece of software (JAR, DLL, HTML) |
| Component | Component icon | Software component deployed on node |
| Communication Path | Solid line | Connection between nodes |
| Dependency | Dashed arrow | One element depends on another |
| Data Store | Cylinder | Database/storage |
19. Big Picture — Which Diagram for What?
| Question | Diagram |
|---|
| How does this process/flow work? | Activity Diagram |
| What states can this object be in? | State Machine Diagram |
| What components exist and how do they connect? | Component Diagram |
| Where does the software physically run? | Deployment Diagram |
| Who does what and when? (roles + flow) | Activity with Swimlanes/Partitions |