- Sequence Diagram Basics
- Step 1: Creating a New Google Docs Drawings Document
- Step 2: Drawing Participants
- Step 3: Adding Messages
- Step 4: Cleaning Up
Step 2: Drawing Participants
To draw the first participant, click the Rectangle tool. The mouse pointer in Figure 3 is pointing to the tool.
Figure 3 The Rectangle tool.
Our sequence diagram has four participants:
- Controller
- Employee
- EmployeeDao
- Database
Draw a rectangle with the Rectangle tool, double-click the rectangle, and type the longest participant name[md]in this case, EmployeeDao (see Figure 4). If the length of the name forces a line break, widen the rectangle until the break is gone. We'll copy this rectangle into more participants.
Figure 4 Our first participant.
Click the Line tool (immediately to the right of the Rectangle tool) and draw a straight line starting from the center of the rectangle down to the bottom of the canvas (see Figure 5).
Figure 5 Drawing the first lifeline.
Use the Rectangle tool to draw a narrow rectangle running down the length of the lifeline, as shown in Figure 6. We'll copy this activation and resize it to make more activations.
Figure 6 Drawing the first activation.
Press Ctrl-A (Mac: Cmd-A) to select everything on the drawing canvas. (Alternatively, choose Edit > Select All.) Press Ctrl-G (Mac: Cmd-G) or choose Format > Group. This command combines all the selected objects into a group so that they can be treated as one object. Select the group, make three copies, and spread them across the canvas as shown in Figure 7. Don't worry about alignment; we'll get to that next.
Figure 7 Copying participants.
Now it's time to see a few of Google Docs Drawings' most powerful features in action. Select everything on the canvas. Right-click a blank spot on the canvas, choose Align Vertically, and then choose Top. All the participants are now flush with the top of the canvas in alignment with one another, but they're spaced unevenly. With everything still selected, right-click the canvas again and choose Distribute > Horizontally. Aligning and distributing objects is a quick way to make drawings look polished and professional, as Figure 8 shows.
Figure 8 Participants aligned vertically and distributed horizontally.
All of the participants still have the name EmployeeDao. Select each participant individually and choose Format > Ungroup, repeating this step until you've ungrouped all of the participants.
Now that all of the objects are ungrouped, double-click each of the top rectangles and change the participant names. Your four participant rectangles should be named as follows, left to right: Controller, Employee, EmployeeDao, Database.