Archyno

Templates

UML class diagram template

Seven classes, an interface and every relationship kind you are likely to need, laid out so renaming the boxes gives you your own domain model.

Notation: UML 2.5.1Diagram: Class diagram

places10..*11..*0..*11Customer- id: UUID- name: String- email: StringOrder- id: UUID- placedAt: Instant- status: Status+ total(): Money+ cancel(): void«interface»PaymentMethod+ charge(m: Money)Card- last4: StringInvoice- terms: DaysOrderLine- quantity: Integer- unitPrice: MoneyProduct- sku: String- name: String- price: Money
The template as it opens. Accent marks the class most edits start from.

Open this template in Archyno

It opens as an editable model, not an image. Change it in the browser, then export to PNG, SVG, Mermaid, XMI, or a Sparx .qea file.

Open this template

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

  1. Rename Customer and Order to the two nouns your domain actually argues about.
  2. Fix the multiplicities before the attributes - 1 to 0..* is a decision, a String is not.
  3. Delete any attribute you cannot name a source for. Half of a first draft is invented.
  4. Keep composition for parts that cannot outlive their whole, and use association everywhere else.
  5. 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

All templates