Generate UML diagram from a textual description
Renato Suero
Posted on January 1, 2019
Hi everyone,
I always hated UML because every tool I saw, I needed to "draw", I feel that I'm less productive.
So I found PlantUML and my world changed, now I could write and generate the diagram. One of the reasons I liked that option is to keep the diagrams updated, now it is simple and fast (to me).
Let's see how we can use the tool.
Firstly, another thing nice to me, I can use docker =).
I use 2 docker images, first to generate the diagram to me. I use https://hub.docker.com/r/think/plantuml/
In this case, I created a file called test.uml:
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
I run this command
cat test.uml | docker run --rm -i think/plantuml > test.svg
cat test.uml | docker run --rm -i think/plantuml > test.png
As you can see, that's the result.
Another way, I run the server to write and see the diagram. I use https://hub.docker.com/r/plantuml/plantuml-server/
In this case, I run the command
docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
then, I open my browser and I access http://localhost:8080. As you can see, that's the result.
If you want to play now you can use the official server, the good thing to use that server, is you can share the diagram
I recommend you access the official documentation, my goal was to show you options to generate your diagrams and help you to be more productive.
I'd like to show you a suggestion how to use dev.to using UML =)
I'd like to invite you to write/draw a diagram and share here in the comments, let's inspire others readers =)
Posted on January 1, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.