PlantUML is an open source tool where you can specify your UML diagrams in a text format. Diagrams are defined using a simple and intuitive language.
All popular IDE’s and Text editors have PlantUML plugins.Here is a post on installing PlatUML for VSCode.The advantages far outweigh the very minor hiccup of learning the PlantUML language syntax. Now the team has an incredible advantage of performing version control of every UML diagram associated with the project. Once you get a hang of writing UML this way, the understanding of your diagrams feels more declarative and intuitive. To draw an analogy, this is very similar to using EMMET for coding your webpages. The biggest advantage is now everyone can read UML as code.
Here is a basic example(You can try online):
'Everything that starts with a simple quote 'is a comment. You can also put comments on several lines using/'to start and '/to end. 'Start of UML diagram @startuml header Awesome PlantUML footer Page %page% of %lastpage% title Sequence Diagram ' Scale determines the size of the output scale 1 ' A single dash in the arrow gives solid line Alice -> Bob: Authentication Request ' A double dash in the arrow gives dotted line Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: Another authentication Response @enduml ' End of UML diagram
Although there are other text formats for UML modelling, Plant UML is one of the most popular formats: It supports many diagram types, automatically lays out your diagram elements, and has a simple, human-readable language.
PlantUML uses the Graphviz software to layout your diagram where the layout algorithm aims connectors in the same direction (top to bottom, or left to right) and attempts to avoid crossed or connectors to make the diagram more readable. Graphviz DOT code can also be used to create flow charts, graphs and more.
PlantUML can do the following:
- Sequence diagram
- Usecase diagram
- Class diagram
- Activity diagram
- Component diagram
- State diagram
- Object diagram
- Deployment diagram
- Timing diagram
The following non-UML diagrams are also supported:
- Wireframe graphical interface
- Archimate diagram
- Specification and Description Language (SDL)
- Ditaa diagram
- Gantt diagram
- MindMap diagram
- Work Breakdown Structure diagram
- Mathematic with AsciiMath or JLaTeXMath notation
- Entity Relationship diagram
Installing PlantUML Locally:
You need the following to run PlantUML:
Now download plantuml.jar and run it to open PlantUML's graphical user interface.
Run PlantUML from the command line
- First, create a text file with PlantUML commands, like this example called sequenceDiagram.txt
@startuml Alice -> Bob: test @enduml
- Then, run (or have your software call) PlantUML, using sequenceDiagram.txt as input. The output is an image, which either appears in the other software, or is written to an image file on disk.
java -jar plantuml.jar sequenceDiagram.txt
This outputs your sequence diagram to a file called sequenceDiagram.png.
-Michael Jesse Chonoles, UML 2 for Dummies
One thought on “PlantUML”