Adventures in Learning Full Stack Web Development

Making Plans with Plantuml

2020.05.11

When it comes to building software, diagrams serve as a useful planning tool. One drawback with diagrams is the time it takes to create them. I like using Plantuml to create diagrams because it allows me to generate diagrams through text, saving me time.

To get started, you just need to have Java and Graphviz installed. Download the plantuml.jar file and keep it handy, you’ll need it later.

Then, create a text file and use the Plantuml language to specify the information you would like to include in your diagram.

The contents of ranch-manager.txt is below:

@startuml

title Ranch Manager DB

' hide the spot
hide circle

' avoid problems with angled crows feet
skinparam linetype ortho

entity User {
  id : number
  --
  name : text
}

entity Plant {
  id : number
  --
  name : text
}

entity Animal {
  id : number
  --
  name : text
}

note left of User #pink
 <size:15><&heart>This is evolving.<&heart></size>
end note

User }|..|{ Plant
User }|..|{ Animal

@enduml

Next, run the Plantuml program that converts the text into a diagram and specify the text file you already created.

java -jar plantuml.jar ranch-manager.txt

And voila! The ranch-manager.png below is generated for you. No dragging, dropping, or color picking required.

Once you learn the language specifications, it’s easy to generate a variety of diagrams through text.

Now your brain can put the extra time toward creative thinking and generating your next big idea.😻