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:
- Sequence diagram
- Usecase diagram
- Class diagram
- Activity diagram
- Component diagram
- State diagram
- Object diagram
- Deployment diagram
- Timing diagram
Examples
1. Hello World sequence diagram
@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
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
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
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.
- Archimate diagram
- Specification and Description Language (SDL)
- Ditaa diagram
- Gantt diagram
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
b. Generate tree diagram easily
@startsalt
{
{T
+ World
++ America
+++ Canada
+++ USA
++++ New York
++++ Boston
+++ Mexico
++ Europe
+++ Italy
+++ Germany
++++ Berlin
++ Africa
}
}
@endsalt
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:
- 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.
- 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.
- 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”