Creating Sequence Diagrams with Google Docs Drawings
Google Docs Drawings is the newest application in the Google Docs lineup. At first glance, the app looks about as sophisticated as Microsoft Paint, but looks can be deceiving[md]and definitely are in this case. Aside from supplying the basic drawing primitives you'd expect (lines, shapes, text, and so on), it features powerful ways to lay them out on screen. Moreover, multiple people can work on the same drawing at once.
I use Google Docs Drawings to create sequence diagrams for technical articles I write. When I started working with the application, each diagram took an hour or so to create, but I've streamlined the process to about 20 minutes. In this tutorial, I'll go through that streamlined process step by step.
Sequence Diagram Basics
Sequence diagrams are a great way to see how objects in a program interact. These objects, called participants, might be class instances, user interfaces, external systems, or just about anything that participates in a running program. Participants are represented as boxes atop sticks called lifelines. Lifelines have arrows pointing to other lifelines, and these arrows represent participants calling methods on each other; more formally, the participants are passing messages to one another. When a message is passed, the object on the receiving end is said to be activated. Activations are represented by narrow rectangles that run down lifelines. Figure 1 shows the anatomy of a sequence diagram. We'll create this diagram (minus the green labels) in this tutorial.
Figure 1 Anatomy of a sequence diagram.
Creating a sequence diagram is a four-step process:
- First we create a new Google Docs Drawings document.
- After creating the document, we draw participants on it.
- The participants don't mean much without the messages they pass to one another, so we focus on those messages next.
- Finally, we clean things up and add a few finishing touches.
Let's get started by creating the document.