Class hierarchy (Nomnoml)

Nomnoml's whole syntax is brackets and arrows. It is the quickest way to sketch a class model, and it has a distinctive look that suits a design note.


#What this example shows

  • Directives controlling direction and spacing.

  • Compartments, separated by pipes.

  • Inheritance, composition and association arrows.


#A worked example

Open it, edit it, or copy the source below.

Class hierarchy (Nomnoml)

The source, which you can paste into a new diagram and edit:

#direction: down
#spacing: 40
#fill: #f8fafc
#lineWidth: 1

[<abstract>Payment|
  amount: Money;
  currency: string|
  authorise();
  capture()
]

[Payment] <:- [CardPayment|
  last4: string;
  scheme: string
]
[Payment] <:- [BankTransfer|
  iban: string
]

[CardPayment] +-> [Card|
  last4: string;
  expiry: date
]

[Order|
  id: uuid;
  status: OrderStatus|
  total()
] o-> [Payment]

[Order] +-> [OrderItem|
  quantity: int;
  unitPrice: Money
]

#Making it your own

  • Directives at the top control the whole diagram; there is no per-node styling to learn.

  • Pipes separate compartments, semicolons separate the lines inside one.

  • For sequence and activity diagrams, use PlantUML.



Specialists. Borrow one when you need it.