Creating diagrams is often a lot of work. While they are useful for conveying complex ideas visually, several issues make the process cumbersome:
Iterations: Diagrams require multiple iterations to get right. Things change as ideas evolve and comments come in. These changes are often reflected in diagrams, and constant manual refinement is time-consuming.
Structural vs. Visual Challenges: When creating diagrams, you’re solving two problems at once:
Nature of tools: Most of the diagramming software are drag-and-drop interfaces. Although it feels intuitive at first, it often works against the diagram designer. The designer easily ends up mixing structural and visual problem spaces too early.
PlantUML is a simple and efficient way to create diagrams using relatively simple syntax. Instead of relying on drag-and-drop tools, PlantUML lets you define the structure of your diagrams and then automatically render them. This approach addresses many of the challenges:
I use VSCode for all operations: writing, previewing and exporting. The plugin can be found from VSCode Marketplace. It's also possible to run PlantUML from command line as well.
# Java
brew install --cask temurin
# Graphviz
brew install graphviz
Author files with extension wsd
. Use VSCode's command palette to run PlantUML or click preview
from top right while you have the file open.
Here are some quick examples to get you started:
@startuml example1
Alice -> Bob: Hello, Bob!
Bob --> Alice: Hi, Alice!
@enduml
@startuml example2
class User {
+name: String
+email: String
+login(): void
}
class Admin {
+manageUsers(): void
}
User <|-- Admin
@enduml
@startuml example3
[*] --> State1
State1 --> State2: Event
State2 --> [*]
@enduml