UML Diagrams: Introduction

what UML is, what it is not, and which diagrams matter most

1.  What UML Is

The Unified Modeling Language is a family of diagram notations for communicating software structure and behavior. It was standardized by the Object Management Group in 1997 and has been revised several times since. The word "unified" reflects its origin: three competing modeling languages (Booch, OMT, and OOSE) were merged into one notation so that teams could share diagrams without negotiating conventions first. UML defines fourteen diagram types, split into two broad groups. Structural diagrams answer the question what exists - packages, classes, components, and their relationships. Behavioral diagrams answer what happens - the sequence of messages, the states a system passes through, the flow of control through an algorithm. You rarely need all fourteen; most practitioners reach for five or six regularly.

2.  What UML Is Not

UML is not a programming language. A diagram does not compile and does not guarantee that the code matches it. Teams that treat a UML model as the authoritative artifact and the code as secondary tend to find the model drifts and loses trust. The more productive use is the opposite: draw a diagram to communicate a decision, then let the code be authoritative. The diagram is a sketch, not a contract. UML is also not a process. Nothing in the notation requires waterfall, iterative, or agile development. You can draw a class diagram during a ten-minute whiteboard conversation just as easily as you can draw it in a formal design document. The value comes from precision of communication, not from ceremony.

3.  Tooling Used in These Pages

The diagrams on these pages are rendered by Mermaid, a JavaScript library that converts text descriptions into SVG diagrams in the browser. Mermaid is not a strict UML tool - its syntax is its own - but it covers the six most-used diagram types and requires no install beyond a single script tag. The diagrams here follow UML conventions where Mermaid allows it and note the differences where it does not. For diagrams that need precise UML notation - formal specifications, published documentation - consider PlantUML (Java-based, generates PNG or SVG from text) or a dedicated modeling tool. Mermaid is the right choice when the goal is readability and ease of maintenance inside a web page or markdown document.

4.  Diagram Types Covered

These pages cover six diagram types, ordered from structural to behavioral. Each page explains what the diagram communicates, describes its notation, and works through an example drawn from the TextFinder project - a directory-search tool implemented in Rust, C++, C#, and Python.
Diagram Kind Primary question answered
Package structural Which named group of code depends on which other group? Where are the compilation boundaries?
Class structural What types exist, what data do they hold, what operations do they expose, and how do they relate?
Component structural What independently deployable units exist, and which interfaces do they provide or require?
Sequence behavioral Which objects exchange messages, in what order, and what does each return?
Activity behavioral What is the flow of control through a process or algorithm, including branches and concurrency?
State behavioral What states can an object occupy, what events drive transitions, and what actions fire on entry or exit?

5.  Choosing the Right Diagram

The most common mistake is reaching for the wrong diagram type. A class diagram cannot show the order in which messages are exchanged; a sequence diagram cannot show that two packages are forbidden to depend on each other. Choosing deliberately saves the reader from having to figure out what you are trying to say. A rough decision rule: if you are communicating a structural constraint (what may depend on what, what fields a type holds, what interfaces a component exposes) use a structural diagram. If you are communicating dynamic behavior (what calls what in what order, how state changes in response to events) use a behavioral diagram. When both aspects matter, draw two diagrams and reference each from the other - do not try to pack everything into one.

6.  References

ResourceDescription
uml-diagrams.org Comprehensive notation reference covering all fourteen UML diagram types with formal examples.
Mermaid Text-to-diagram library used to render all diagrams in this sequence.
PlantUML Java-based text-to-diagram tool with stricter UML compliance than Mermaid.
TextFinder Project Story Architecture, CLI, performance, and metrics for the project used as the worked example throughout.