UML
01 / 02

UML Fundamentals: Class, Sequence & Use Case Diagrams

UML: Class, Sequence & Use Case Diagrams

UML (Unified Modeling Language) is a standardized, general-purpose visual modeling language for designing and documenting a software system's architecture and behavior. It doesn't produce running code -- it provides a common notation so different people consistently understand a system's design.

Class Diagrams: Static Structure

Customer 1 ------ 0..* Order
                        | composition (filled diamond)
                        | LineItems don't exist independently
                        v
                    LineItem

Dog --|> Animal   (inheritance -- hollow triangle, solid line)
PaymentProcessor - -|> Payable   (interface implementation --
                                   hollow triangle, DASHED line)

# Multiplicity (1, 0..*, 1..*) makes cardinality explicit --
# a Customer has zero or more Orders; each Order belongs to
# exactly one Customer

Association vs. Aggregation vs. Composition

  • Association -- general 'uses/references' relationship.

  • Aggregation -- whole-part where the part can exist independently (a Department has Employees, who can be reassigned).

  • Composition -- stronger whole-part where the part's lifecycle is tied to the whole (an Order's LineItems don't meaningfully exist without it).

Sequence Diagrams: Time-Ordered Interaction

LoginForm       AuthController       UserRepository       Database
    |----submit()------->|                    |                  |
    |                    |----findUser()----->|                  |
    |                    |                    |----query()------>|
    |                    |                    |<---row------------|
    |                    |<---user------------|                  |
    |<---result----------|                    |                  |

# Complements a class diagram's static view with a specific
# scenario's exact runtime call sequence

Use Case Diagrams: External User Perspective

Shows 'actors' (users or external systems) and the 'use cases' (goals) they perform -- Customer connected to 'Browse Products', 'Place Order', 'Track Shipment'. Non-technical and functionality-focused, often more approachable for business stakeholders than a class or sequence diagram.

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free