ZenUML

Core library version:

An online (and offline) Sequence Diagram generator
This site is a fork of ReactJs.org. It is under construction.

Declarative

ZenUML makes it painless to create complex sequence diagrams. Design simple DSL, and ZenUML will efficiently update and render just the right section of your diagram when your DSL changes.

Component-Based

The DSL of ZenUML is Component-based. You can compose different components (such as message, condition fragment, loop fragment, etc.) to build more complex diagrams.

Learn Once, Write Anywhere

ZenUML comes with the main website, a Chrome extension and also as an Atlassion Confluence plugin.

ZenUML main site and the Chrome extension work perfectly offline. You only need to connect to the internet to save you DSL to the cloud.


A Simple Example

A simple ZenUML DSL starts with a root method, such as Controller.getBook(id). It means we are invoking a action on or sending a message the participant ‘Controller’.

Line 1: By default, the starting participant is omitted. In this example, we use @Starter(Browser) to specify a starting participant named ‘Browser’.

Line 2: This a comment line. Currently, we only support one line per statement. A comment starts with //.

Line 3: In this line, we let the method call return a Book. You can also try Book b = ....

Line 4: This is the next step in the flow. Note the {} which means a nesting relationship. Or in another way, you can say the logic inside {} is the implementation of method Controller.getBook().

Fragments - Alt and Loop

In addition to simple workflow, ZenUML can also handle alt and loop logic. No surprising, we are using keywords that are commonly found in most of the programming languages.

Line 2: We use if(condition) for alt fragments. You just need to put the conditions in (). A “string”, a normalWord, or an expression (such as a > 1) can be considered as a condition.

for, while, foreach or forEach are all considered a looping keyword. Try it by replacing if with while.

Creation

Using new, we can create a new participant. You can assign the created instance to a variable with AnInterface result = new AClass. The created participant will have the name result:AClass and returned value will be result:AnInterface. AnInterface is optional.

Async message

Normal messages in will produce message bars on the lifeline. A message bar represents a duration of the execution. If you would like to present only a message from one participant to another, async message gives you more flexibility.

In an async-message sentence (e.g. Alice->Bob: How are your?), you need to provide the source participant (Alice), the target participant (Bob) and the message (the message).