Chapter 2: A Tour of Visio
This book focuses on using Visio to support the software development process. Throughout the book, you'll find examples of using Visio to diagram various aspects of software and software designs. In most cases, those diagrams will be built using the UML. Since Visio is central to the material covered in the following chapters it makes sense to take an early look at the features and capabilities of the product and point out various aspects of Visio that aid software development. Therefore, the purpose of this chapter is to
Fundamentally, Visio is a diagramming package. When most business software users hear the
The point is this - Visio is a powerful application that has found many uses in a variety of places. As developers we can benefit from the functionality others already enjoy. In addition to support for UML diagrams, Visio also supports building a variety of other software-oriented diagrams including Windows
Before we delve into detailed software diagrams let's look at some basic Visio operations - how to create and manipulate simple diagrams and work with some common Visio functions. After that, we'll examine some of the more technical, software development-oriented Visio tools.
Beginning Visio - A Simple Diagram
Many developers are already familiar with Visio or have enough experience with similar packages that we don't need to spend a lot of time reviewing how to produce simple diagrams. Since the balance of this chapter heavily depends on the reader's ability to interact with drawing
The Visio Environment
The main working view in Visio is very similar to the following. We use "very similar" because each
The first thing to notice is the familiar (dare we say 'comfortable'?) look and feel of the UI. The main menu is spread across the top of the form over the top of a number of toolbars, with the choice of which
Obviously, the main portion of the UI is designed for drawing. The white page lined with horizontal and vertical grid lines represents, by default, a single printed page - this grid can be switched on or off, and a snap feature can be set so that objects snap onto the grid lines, and of course the grid line spacing can be adjusted. Visio calls this area the drawing page. It's
Arranged vertically along the left side of the UI are groups of drawing shapes. Shapes and the lines that can connect them are the heart of any Visio drawing. Shapes can represent discrete, physical objects such as a piece of networking equipment or something more abstract like the relationship between types of data in a high-level database diagram. Shapes are also
When multiple stencils are
One other quick comment about the basic Visio environment before we dig into shape and line details - Visio groups multiple pages together into one drawing using the Page Tab on the lower left of the main drawing window. Notice in our screenshots there exists one tab labeled Page-1 . Visio gives us the ability to create multiple pages and store them in one drawing file. To add a new page either select Insert New Page from the main menu or right-click on the Page Tab and select Insert Page . You'll see a dialog box for the new page that looks like the following screenshot.
Notice the highlighted page name. Pressing the OK button adds a new page to the drawing document named New Wrox Page . Also, notice that other page properties are available when you create the new drawing page. We won't review the details here, but you have the option of including many pages within a single drawing that all have different page properties - such as size, or orientation.
With the addition of our new page, the drawing environment now looks like this:
Shapes are merely drawings that represent something else. As we've already discussed, the things shapes represent can be as simple as a piece of equipment like a
Using our simple flowchart example, let's look at how we get a shape onto the drawing page and what we can do with the shape once it's there. From the Basic Flowchart Shapes stencil, let's draw a Process shape. We don't really draw the shape on the form; we drag it from the stencil to the drawing page. Using the mouse, click on the Process shape - it's the first shape in the stencil in the first row. With the mouse button still clicked down, drag the Process shape onto the drawing page and position it somewhere in the middle of the page. It will look something like this:
Wow, a box! So what's the big deal about this? Well, as simple boxes go, it's not too exciting. However, what we're about to discover is that the simple box is actually a
shape that has custom properties specific to that shape type. That means the shape has some intelligence. It
Our little box has gotten
Let's examine a few other shape features before we move on. One of the most common tasks is
At this point we have a single shape on our drawing page and some custom data for that shape's
. We also have some text inside the shape to identify it. To make the drawing useful at all we probably want to connect the shape to other shapes. Since our little example is a simple flowchart, let's create a flowchart consisting of four steps -
. If we drag three more
shapes onto the drawing page and give them the appropriate text, our drawing page will look like the following screenshot with a little shape
From the titles of our shapes, the order of this flowchart is clear, but to make it
Scroll down the stencil until you find it. In this stencil, it's in the second to last row in the middle column. Drag the connector onto the drawing page just like the shapes. Visio will draw a line with a couple of ninety degree breaks and an
To connect two shapes together using the
, click on one end of the line with the mouse pointer and hold it down. Drag that end to one of the connection points on the shape. If you look closely at the shape
you'll notice four connection points - one on each side of the rectangle. If you drag the end of your connector to one of those connection points, it turns red and repositions the end of the line to be flush with one side of the shape. Once a connector line and the shape are associated this way, the end of the line is said to be glued to the shape. Here's what it looks like (you won't see the red
The same process is repeated with the other end of the connector line to glue that end to the Process Two shape. Now we have two shapes with a single line connecting them. Even though it's an extremely simple diagram, there's no doubting what relationship exists between Process One and Process Two . Nor is there any confusion about what happens after Process One .
If you repeat the same process with all the shapes, you'll get a diagram that looks something like this:
Since the shapes and their connectors are glued together, we can drag shapes all around the drawing page and their connectors will retain their relationships.
Again, this is a simple diagram, but the idea that Visio makes drawing complicated diagrams easy should be clear.
Here are a few more comments about connectors before we continue. Firstly, you have quite a few options regarding the end points, size, and color of your connectors. In the drawing, right-click on one of the connector lines and select Format Line . You'll see this dialog:
Using this dialog it's not only easy to change the beginning and end of the line - what kind of arrow, if any, but it's also easy to change the connector line pattern,
Notice how the connectors were automatically rerouted around the new shape. That's a handy feature and more times than not Visio does a good job at redrawing connector paths. Sometimes, however, it's necessary to tell Visio not to reroute when you move shapes around. To do that right-click on the connector for which you want to disable rerouting and select Never Reroute . Now Visio will allow other shapes to be drawn over top of your connector without moving it.