Markdown ZenUML sequence maker
Draw a sequence by writing it as code. Name your participants, then write each call and its return, and ZenUML lays out the lifelines, arrows and activation bars for you inline in your document.
ZenUML sequence syntax
A ZenUML block starts with the word zenuml. You list your participants, then write the story as calls between them. A call reads like code: one object calls a method on another, and the body of that call goes in braces. Here is each piece you can write.
Participants and messages
Declare a participant with a stereotype like @Actor or @Database, then send a plain message with A->B: text.
zenuml
@Actor Customer
@Boundary Web
Customer->Web: open page
Web->Customer: show form
Synchronous calls and returns
Write a method call as A->B.method(). Put the work it triggers in braces, and end with return value to send a result back.
zenuml
@Actor Customer
@Boundary Web
@Control OrderService
Customer->Web.checkout() {
Web->OrderService.create() {
return orderId
}
return page
}
Creating an object
Write new B to create an object, or x = new B() to name the thing you made.
zenuml
@Control OrderService
OrderService->OrderService.build() {
order = new Order()
return order
}
Cheat sheet
| Write this | You get |
|---|---|
zenuml | Start a ZenUML sequence |
title Text | Title the diagram |
@Actor Name | A participant drawn as an actor |
@Boundary Name | A boundary (edge of the system) |
@Control Name | A control (coordinating logic) |
@Entity Name | An entity (a thing being worked on) |
@Database Name | A database |
@Queue Name | A message queue |
A->B: text | A plain message from A to B |
A->B.method() | A synchronous call to B.method() |
A->B.method() { … } | A call whose body is the nested messages |
return value | Return a result from the current call |
A->A: text | A self message |
new B | Create an object of B |
x = new B() | Create B and name it x |