NAV Navbar
DSL

Introduction

With ZenUML, you can create and edit sequence diagrams with ease. Since ZenUML auto-generates a sequence diagram from the text you enter, you can focus on more important activities - modelling.

You can use ZenUml DSL to draw sequence diagram online or use the Web Sequence Chrome Extension.

A few examples

Sample1

Sample2

Sample4

Send a message

To send a simple message, use this code:

result = A.methodA(p1, p2);

It contains 4 parts:

  1. result - the result of methodA. This part is omitted in the diagram.
  2. A - the entity. Any string that is a valid Java (or C# or C) variable name is a valid Entity name.
  3. methodA - the name of the message
  4. p1, p2 - the parameters of this method.

Nested message

B.methodB(p3, p4) is the nested message

A.methodA(p1, p2) {
  B.methodB(p3, p4)
}

A nested message can be considered as the implementation of its parent message (method). It must be wrapped within {}.

Send a self message

To send a message to the participant itself

result = internalMethod(p1, p2);

It contains 3 parts:

  1. result - the result of methodA. This part is omitted in the diagram.
  2. internalMethod - the name of the message
  3. p1, p2 - the parameters of this method.

Alt

if (condition1) {
  A.methodA()
} else (condition2) {
  B.methodB()
} else {
  C.methodC()
}

condition can be of a word or a simple expression such as a < b.

Loop

while(condition) {
  A.methodA()
}

while, for, foreach, forEach are treated equally. condition can be of a word or a simple expression such as a < b.

New

instance = new AClass()

Use new keyword for object creation. instance = is optional.

Async

Alice->Bob: How are you?

Asyc message does not have a message bar on the lifeline.

Errors

DSL