Nomnoml

Nomnoml draws class-style UML from a very small syntax: names in brackets, arrows between them. It has a distinctive look and gets out of the way.

It suits sketching a class model quickly, where full UML would slow you down.


#What it is good at

  • Quick class and package sketches during design.

  • Teaching material where the syntax should not be a distraction.

  • Diagrams embedded in code comments and READMEs.


#What it draws

Diagram

Syntax starts with

Class

[ClassName]

Association

[A] -> [B]

Inheritance

[A] <:- [B]

Composition

[A] +-> [B]

Compartments

[Name|field;field|method()]

Directives

#direction: right


#A worked example

Classes with compartments and inheritance:

Nomnoml

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

#direction: down
#spacing: 40

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

[Payment] <:- [CardPayment]
[Payment] <:- [BankTransfer]
[CardPayment] +-> [Card|
  last4: string;
  expiry: date
]
[Payment] -> [Ledger]

#A few things that catch people out

  • Directives at the top control layout: #direction, #spacing, #fill.

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

  • For full UML with sequence and activity diagrams, use PlantUML.



Learn one properly. Borrow the rest when you need them.