Are you getting tired the variety of tools to generate diagrams?

Have you found difficulties in tracking changes of diagrams?

Have you drawn a complex diagram, and suddenly became frustrated as you need to resize and align all the rectangles?

Let’s get to know PlantUML….

Overview

PlantUML is regarded as an open-source tool that enables users to create UML diagrams from a plain text language. In this case, diagrams are defined using a simple, human-readable text description, and intuitive language.

It uses Graphviz software to form its diagrams and additionally, this software has been used to help blind software engineers to design and read UML diagrams.

Core Diagram Feature

PlantUML supports most standard UML diagram types as well as many other diagram types like GraphViz, Salt, ASCII Art, and Xearth. Currently, it supports following diagram:

Examples

1. Hello World sequence diagram

plantuml example

@startuml

Bob->Alice: hello

@enduml

2. Authentication sequence diagram

@@startuml

Alice -> Bob: Authentication Request

alt successful case

Bob -> Alice: Authentication Accepted

else some kind of failure

Bob -> Alice: Authentication Failure

group My own label

Alice -> Log : Log attack start

loop 1000 times

Alice -> Bob: DNS Attack

end

Alice -> Log : Log attack end

end

else Another type of failure

Bob -> Alice: Please repeat

end

@enduml

Authentication sequence diagram plantuml

3. Simple online shopping checkout use case diagram

@startuml

left to right direction

skinparam packageStyle rectangle

actor customer

actor clerk

rectangle checkout {

customer -- (checkout)

(checkout) .> (payment) : include

(help) .> (checkout) : extends

(checkout) -- clerk

}

@enduml

Simple online shopping checkout use case diagram plantuml

4. Simple activity diagram

@startuml

[*] -right-> Requirement 

Requirement  -right-> Design

Design  -right-> Development

Development  -down-> Verification

Verification  -down-> Preview

Preview  -right-> Deploy

Deploy  -right-> Operation

Operation  -right-> [*]

@enduml

Simple activity diagram plantuml

Other Types of Diagram

The following non-UML diagrams are also supported:

  • Wireframe graphical interface

Salt is a subproject included in PlantUML that may help you to design graphical interface.

Mathematic with AsciiMath or JLaTeXMath notation

a. Example of generating graphical interface

@startsalt

{+

{* File | Edit | Source | Refactor

Refactor | New | Open File | - | Close | Close All }

{/ General | Fullscreen | Behavior | Saving }

{

{ Open image in: | ^Smart Mode^ }

[X] Smooth images when zoomed

[X] Confirm image deletion

[ ] Show hidden images

}

[Close]

}

@endsalt

Example of generating graphical interface plantuml

b. Generate tree diagram easily

@startsalt

{

{T

+ World

++ America

+++ Canada

+++ USA

++++ New York

++++ Boston

+++ Mexico

++ Europe

+++ Italy

+++ Germany

++++ Berlin

++ Africa

}

}

@endsalt

Generate tree diagram plantuml

Integration and Advanced Features

Besides support many diagram types, PlantUML also support a lot of customization, for example: paging, footer, header, zoom, title, caption, legend, handwriting, and export to PDF/PNG/SVG/TXT/ASCII.

It also have various integration and plugin with existing software/tools: Eclipse, Microsoft Word, Google Docs, Visual Studio Code, ItelliJ IDEA, Javadoc, and Attlassian Confluence just to name a few.

Conclusion

We have three main benefits when using PlantUML:

  1. Once you mastered the basics of the syntax, you will be able to generate UML diagrams instantly in comparison to the typical drag and drop tools. You can do this without being drawn away by aesthetic details or the use of a mouse. All you need to do is type PlantUML into any editor to produce a professional, clear diagram.

  2. The diagrams are based on ASCII, which means that you can use your own source control software to version and perform diffs on them for collaborative work and you are also able to parse the text programmatically while using other tools like NPlant.

  3. It enables you to concentrate on the relationships and complex ideas that need to be featured in your design. This makes it easier for you as you no longer have to endlessly resize and align rectangles.

We can summarise PlantUML in just a single sentence:

“This is how UML tools should have been from the beginning” 

References:

  1. PlantUML main references: http://plantuml.com/
  2. Complete PlantUML language reference: http://plantuml.com/PlantUML_Language_Reference_Guide.pdf
  3. PlantUML source code: https://github.com/plantuml/plantuml
  4. Generate diagram easily: https://www.planttext.com
  5. More diagram examples: https://real-world-plantuml.com
  6. Müller, Karin (2012). "How to Make Unified Modeling Language Diagrams Accessible for Blind Students". In Klaus Miesenberger. Computers Helping People With Special Needs 13th International Conference, ICCHP 2012, Linz, Austria, July 11-13, 2012, Proceedings, Part I. Berlin [u.a.]: Springer-Verlag New York Inc. pp. 186–190. ISBN 978-3-642-31521-3.