This post is part of a periodic series about The Tools I Use.

I occasionally feel the need to draw UML diagrams to help me understand or communicate the design of some code I’m working on. My preferred medium for this is a whiteboard, but since I work remotely, that’s often not an option.

Recently, I was trying to understand a fairly involved process in our code base at work. The basic model of the process is a state machine, so I wanted to use a UML state diagram to understand it.

I looked into a number of UML tools and discovered PlantUML. PlantUML allows you to specify a UML diagram using a very simple text-based syntax. It then turns that into a diagram using Graphviz.

PlantUML supports the main UML diagram types: sequence, use case, class, activity, component, state, and object diagrams.

While you can use PlantUML from the command line or an automated build system to generate the diagrams, it also integrates with a number of other tools for a faster feedback loop. There are plugins for many wikis, text editors, IDEs, languages, and documentation generators. For example, I used the IntelliJ plugin to run it in RubyMine when I was creating my state diagram. As I added to my diagram definition, the plugin continuously updated the diagram so I could see what it looked like.

There’s even an online server where you can play with the tool and generate a diagram to take with you.

I haven’t used this tool a lot yet, but it’s been very handy for what I have done with it. Give a try next time you need to draw a UML diagram and a whiteboard isn’t good enough.