UML class diagram template: online store
Seven classes showing association, composition and inheritance.
About this template
A class diagram shows the types in a system, what they hold, what they can do and how they relate. This template models the core of an online store and uses the three relationships you will draw most often, each with its correct line ending.
An order is composed of line items: they cannot exist without it, so the line has a filled diamond at the order. Card and PayPal payments are kinds of payment, so they point to it with a hollow triangle.
What is in the diagram
- Compartments
- Name on top, then attributes, then operations. A minus sign means private, a plus sign public.
- Composition
- Filled diamond on the owner's side. Deleting the order deletes its line items.
- Inheritance
- Hollow triangle pointing at the parent class.
- Association
- A plain line or open arrow: one class knows about another.