UML class diagram template
Six classes, an interface, and the association, composition and realization lines between them, laid out so renaming the boxes gives you your own domain model.
Notation: UML 2.5.1Diagram: Class diagram
Open this template in Archyno
It opens in the editor as an editable model, not an image. No account needed: change it, then export to PNG, SVG, Mermaid or XMI. A free account, no card, saves it and adds the Sparx .qea export.
What is on this diagram
- Customer
- The party the model exists to serve. Rename to your own actor.
- Order
- The thing that party creates. Usually the class everything else hangs off.
- OrderLine
- The line items. Composed of the order, so they die with it.
- Product
- The catalogue an order line points at, and outlives it.
- PaymentMethod
- An interface: the point where behaviour varies by subtype.
- Card / Invoice
- Two realizations. Add a third rather than a boolean flag.
How to make it yours
- Rename Customer and Order to the two nouns your domain actually argues about.
- Fix the multiplicities before the attributes - 1 to 0..* is a decision, a String is not.
- Delete any attribute you cannot name a source for. Half of a first draft is invented.
- Keep composition for parts that cannot outlive their whole, and use association everywhere else.
- Add operations last, and only where behaviour belongs to the class rather than to a service.
Common questions
What should a class diagram template include?
Enough structure to be worth editing and no more: a handful of classes with real attributes, at least one interface with two realizations, and the multiplicities filled in. Everything beyond that is a guess about your domain and is faster to add than to remove.
When do I use composition instead of association?
Use composition, the filled diamond, when the part cannot exist without the whole and is deleted with it - an order line without its order is meaningless. Everything else is an association, including the cases where deletion happens to cascade in the database.
Can I export this class diagram template to another tool?
Yes. Opening the template in Archyno gives you a real model rather than a picture, so it exports to a Sparx .qea file, to XMI 2.5.1, and to Mermaid for a repository, as well as to PNG for a document.
Read the notation
How to read and draw a UML class diagram: the three compartments, visibility markers, multiplicity, and the difference between association, aggregation, composition, generalization and realization.
The Unified Modeling Language in practice: the fourteen diagram types, how structure and behaviour split, and how to pick the right diagram for the question you are actually asking.
How to read and draw an entity-relationship diagram: entities, attributes, primary and foreign keys, relationships and cardinality in crow's foot notation, the conceptual-logical-physical progression, and how an ER model differs from a UML class diagram.
A reference for UML class diagram notation: the six relationship kinds and their arrowheads, the three visibility markers, multiplicity syntax, and what a stereotype in guillemets means.
How to read and draw a UML object diagram: instance specifications, underlined names, slots with concrete values, links, and how to use one to sanity-check a class diagram.
A worked banking system example in UML: the double-entry domain model where a balance is derived rather than stored, and the state machine a transfer moves through.
What an AI UML generator is actually good at, the four errors it repeats, how to prompt for a diagram worth keeping, and the two-minute review that catches the rest.
The symbols UML actually uses, across every diagram type: boxes, ellipses, diamonds, bars and 3D nodes, plus the six relationship lines and the arrowheads that tell them apart.
A decision guide to the fourteen UML diagram types: what each answers, which four carry most real work, and which are safe to skip until you meet one.