The Unified Modeling Language (UML) is used to specify, construct, visualize, and document a software system. Many teams are adopting UML for its life cycle approach to modeling software development and ability to represent everything from analyzing requirements and use cases to system implementation. Like blueprints, UML diagrams help teams visualize a system's architecture at each step in the development process, which typically includes the following phases:
With Visio, you can create the eight UML diagram types associated with each phase. Each diagram provides a different view of the software system. For example, use case diagrams show the software system from a user's perspective, whereas class structure diagrams translate user requirements into software classes and relationships. Most people linger in the design requirements phase and create class structure diagrams, which Visio can even create for you based on existing Visual C++ 6 or Visual Basic 6 code.
A Visio drawing file represents one software system and can include many models and diagrams for the system. Visio maintains the entire system model in the Model Explorer, a window that gives you a comprehensive picture of a software system and its elements—that is, the building blocks in each model, such as classes, use cases, and components. Elements are grouped into packages, which simply provide organization much as a file folder organizes documents. Each diagram within a package represents a view of the model. The current system model appears at the top of the Model Explorer window with the following default placeholders, as Figure 20-3 shows:
You use the Model Explorer to create blank pages for UML diagrams. Then, you drag shapes from the UML stencils onto the drawing page to create the UML diagram. As you drag shapes onto the drawing page, Visio adds UML elements to the Model Explorer. In this way, you build the model as you create a diagram. Once you've created several UML diagrams, you can navigate between the diagrams by double-clicking a diagram in the Model Explorer or clicking a page tab at the bottom of the drawing window.
Figure 20-3. The Model Explorer contains all the elements of your model, whereas the drawing page contains assorted views.
The UML menu is no longer visible.
Solution-specific menus can disappear when Visio encounters an unexpected error from an external source. If the UML menu disappears, choose Tools, Options. On the Advanced tab, select Enable Automation Events, and then click OK. Save changes to any open diagrams, and then exit Visio. Restart Visio Professional, and then open your UML file or the UML Model Diagram solution.
UML was invented by Grady Booch, Jim Rumbaugh, and Ivar Jacobson, who are well known in object-oriented modeling circles for their pioneering work. UML combines the best notational tools from each of its authors' own methodologies: Booch, OMT (Object Modeling Technique, from Rumbaugh), and OOSE (Object-Oriented Software Engineering, from Jacobson). A language, not a methodology, UML provides a notation for documenting the software development cycle, but it does not prescribe any particular process. Similarly, the diagram types in Visio roughly correspond to the phases a development process might follow without recommending any particular process.
In the Model Explorer, you can create packages to divide large diagrams and models into manageable subsets. The top package for the model serves as the container for all the elements, packages, and diagrams you create as part of the model. Each element can be owned by only one package, and one package can be nested in another. To see all the packages in a system model, choose UML, Packages, as Figure 20-4 shows.
Table 20-1 describes how to use the Model Explorer to create packages and add elements to system models.
Figure 20-4. Specify commonly used values (Stereotype, IsRoot, IsLeaf, IsAbstract) in the UML Packages dialog box, or select a package, and then click Properties to see all package settings.
Table 20-1. Techniques for Working with Packages in the Model Explorer
Create a new package in the model
Right-click an existing package, and then choose New, Package.
Add a package to a diagram
Display a diagram drawing page. Drag the Package shape from the UML Static Structure, UML Use Case, UML Component, or UML Deployment stencil onto the drawing page.
Add elements to a package
Right-click a package, choose New, and then choose the type of element.
Represent package contents in a diagram
Right-click a package, choose New, and then choose the type of diagram you want to include in the package. Visio displays the appropriate stencil and a blank drawing page. Drag shapes representing the elements you want to include in the package onto the drawing page.
As you drag shapes from the stencils onto the drawing page, Visio adds UML elements to the Model Explorer. However, you can add elements to your model without adding them to a diagram by right-clicking a package, and then choosing New. When you add an element in this fashion, it does not appear in a diagram, but you can drag the element from the Model Explorer to a drawing page to add an element shape to a diagram.
You can also delete elements from your model. When you delete an element from the Model Explorer, Visio also deletes it from all UML diagrams. However, when you delete a shape from a diagram, Visio deletes only the representation of the element. The corresponding element remains a part of the model and is displayed in the Model Explorer.
The Model Explorer is no longer visible.
The view might have changed. In the Model Explorer window, you can view other property and documentation information. To change views in the window, right-click a tab at the bottom of the window. You can also select a view by choosing UML, View.
The UML Model Diagram template includes all the shapes you need to create static structure, use case, collaboration, sequence, component, deployment, activity, and statechart diagrams. Shapes represent the UML notation and behave in ways that are consistent with UML semantics. For example, the Class shape has three compartments for name, attributes, and operations, and the shape expands automatically as you add values.
To change the values that appear on shapes, right-click a shape, and then choose Shape Display Options, as Figure 20-5 shows. After you select the values you want to display, you can choose whether to apply the changes to shapes other than the one you selected to keep your model consistent. To change all the shapes of the same element type on the current drawing page, select the first of the two check boxes near the bottom of the dialog box (Apply To The Same Selected UML Shapes ...). To change all the shapes of the same element type that you add to the page, select the other check box (Apply To Subsequently Dropped UML Shapes ...).
Figure 20-5. The options in the UML Shape Display Options dialog box vary depending on the selected shape. Here, you can choose the values to display on a Class shape.