Why
We often need to use UML tools in our daily work. There are plenty of commercial or open source UML tools - List_UML_Tools. The reason that I would like to introduce you this PlantUML + Gravizo:
- More lightweight and Open Source
- UML diagrams are created via Diagrams are defined using a simple and intuitive language.
- Friendly to version control system.
What is PlantUML
To be able to generate some diagrams, you must have Graphviz software installed on your machine.
What is graphviz
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.
Prerequisites
- plantuml
- graphviz
- VS Code + plantuml(plugin) + markdown (Optional)
Note: Make sure plantuml command line is available
How to Show/Generate Diagrams
PlantUML command line
⇒ plantuml test_flow.wsd
You will find a png file generated
UML diagram in VS Code with markdown
```plantuml @startuml actor User participant "First Class" as A participant "Second Class" as B participant "Last Class" as C User -> A: DoWork activate A A -> B: Create Request activate B B -> C: DoWork activate C C --> B: WorkDone destroy C B --> A: Request Created deactivate B A --> User: Done deactivate A @enduml ```
Press Ctrl + K, V then a preview will be shown
PlantUML Web Server
http://www.plantuml.com/plantuml/uml/
Sequence Diagram
@startuml
participant User
User -> A: DoWork
activate A #FFBBBB
A -> A: Internal call
activate A #DarkSalmon
A -> B: << createRequest >>
activate B
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml
Class Diagram
@startuml
class Car
Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns
@enduml
Gantt Diagram
@startgantt
project starts the 2018/04/09
saturday are closed
sunday are closed
2018/05/01 is closed
2018/04/17 to 2018/04/19 is closed
[Prototype design] lasts 14 days
[Test prototype] lasts 4 days
[Test prototype] starts at [Prototype design]'s end
[Prototype design] is colored in Fuchsia/FireBrick
[Test prototype] is colored in GreenYellow/Green
@endgantt
More
PlantUML supports more type of diagrams than that I mentioned above, it also supports Math diagram in latex but needs additional software (AsciiMath or JLaTeXMath).
@startuml
participant User
User -> A: DoWork
activate A #FFBBBB
A -> A: Internal call
activate A #DarkSalmon
A -> B: << createRequest >>
activate B
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml