Modeling Software Systems Using UML

UML (Uniform Modeling Language) specifies, constructs, visualizes, and documents a software system. Many teams are adopting UML because of its life-cycle approach to modeling software development and its 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 Professional 2007, 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 Professional 2007 can even create for you based on existing code.

Inside Out: Learning more about UML

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 (Muller, Wrox Press Ltd, 1997). You can also download additional UML 2.0 information from http://www.ibm.com/developerworks/rational/library/05/321_uml/


Using the Model Explorer

A Visio Professional 2007 drawing file represents one software system and can include many models and diagrams for the system. Visio Professional 2007 displays the 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-2 shows:

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


  • 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 Professional 2007 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#, 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#, C++, IDL, or Visual Basic data types by default. You can also create packages that include your own data types.

Note

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 by right-clicking Top Package, selecting New, and then selecting the diagram that you want to add from the drop down menu. 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 Professional 2007 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.

Troubleshooting: The UML menu is no longer visible

Solution-specific menus can disappear when Visio Professional 2007 encounters an unexpected error from an outside source. If the UML menu disappears, choose Tools, then Options. On the Advanced tab select Enable Automation Events and click OK. Save changes to any open diagrams, and then exit Visio Professional 2007. Restart Visio Professional 2007 and then open your UML file.


About UML

UML was invented by Grady Booch, Ivar Jacobson, and Jim Rumbaugh, 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 Professional 2007 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-3 shows.

Figure 20-3. 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 describes how to use the Model Explorer to create packages and add elements to system models.

Table 20-1. Techniques for Working with Packages in the Model Explorer
TaskTechnique
Create a new package in the modelRight-click an existing package in the Model Explorer, and then choose New, Package.
Add a package to a diagramDisplay 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 packageRight-click a package in the Model Explorer, choose New, and then choose the type of element.
Represent package contents in a diagramRight-click a package in the Model Explorer, choose New, and then choose the type of diagram you want to include in the package. Visio Professional 2007 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 Professional 2007 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 Professional 2007 also deletes it from all UML diagrams.

Caution!

When you delete a shape from a diagram, Visio Professional 2007 deletes only the representation of the element. The corresponding element remains a part of the model and is displayed in the Model Explorer.

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 on shapes, right-click a shape, and then choose Shape Display Options, as Figure 20-4 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-4. 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.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset