Modeling Software Systems Using UML

3 4

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:

  • Analyze use cases. To describe the interactions between external actors and your system, you can create a use case diagram that depicts system requirements and the terminology used in the domain area.
  • Analyze the domain. To provide a conceptual understanding of the objects and relationships in the real world that your system represents, you can create conceptual (also called object) static structure diagrams and sequence diagrams. To understand the life cycle of an object, you can create activity and statechart diagrams as well.
  • Define design requirements. To develop a programming solution that meets the use case and domain requirements, you can create collaboration diagrams to determine how objects will communicate and class static structure diagrams to define the classes that you will implement in the software.
  • Plan the implementation. To describe the physical and component structure of the development environment, you can create component diagrams and deployment diagrams.

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.

InsideOut


UML is an extensive (and extensible) notation, and this chapter only brushes the surface of the topic of software modeling. To learn more about UML, search the Microsoft Developer Network (http://msdn.microsoft.com), which includes chapters from the book Instant UML. You can also download the complete notation specification, UML Notation Guide Version 1.1, in PDF format from http://www.rational.com.

Using the Model Explorer

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:

  • Static Model. Represents all the packages, elements, and views of one system model.
  • Top Package. Represents the highest level of package in the model and contains all the static model elements and views.
  • Static Structure-1. Represents a diagram and corresponds to a drawing page of the same name as the icon. By default, Visio inserts a static structure diagram in a new static model. To display the drawing page for a diagram, double-click the icon.
  • Data Types. Represents all other model abstractions that are not elements. By default, a new model includes a package that contains the common Visual C++, IDL, and Visual Basic data types. You can delete the data type package and you can choose whether a new system model will include C++, IDL, or Visual Basic data types by default. You can also create packages that include your own data types.

Tip


To rename any item in the model, right-click a name in Model Explorer, choose Rename, and then type a new name.

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.

Figure 20-3.  The Model Explorer contains all the elements of your model, whereas the drawing page contains assorted views.


Troubleshooting

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.


About UML

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.


Defining Packages

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.

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

Task Technique

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.

Adding and Deleting Elements

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.

Tip


To quickly change the properties of an element, such as its name, attributes, or operations, double-click the element, change the properties in the UML Properties dialog box, and then click OK.


Troubleshooting

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.


Customizing UML Shapes

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.

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.



Microsoft Visio Version 2002 Inside Out
Microsoft Visio Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612854
EAN: 2147483647
Year: 2000
Pages: 211
Authors: Nanette Eaton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net