Use Visio for UML modeling

Source: Internet
Author: User

Use Visio for UML modeling

Content outline:

1. UML modeling environment in Visio
2. use case diagram
2.1 use case diagram Composition
2.2 create a use case diagram
2.2.1 create a role)
2.2.2 create Use Cases
2.2.3 establish communication between roles and Use Cases
2.2.4 establish the relationship between Use Cases
2.2.5 create a use case diagram
3. Create an activity diagram
3.1 composition of the activity diagram
3.2 Create an activity diagram
4. Use of static structure digraphs
Composition of 4.1 static structure charts
4.2 create a static class structure chart
4.2.1 create a class
4.2.2 establishing inter-class relationships
5. Create a sequence diagram
6. Visio and Ms. net
6.1 Visio generate. Net code
6.2 generate a UML diagram in Visio from. net
References

1. UML modeling environment in Visio

The Microsoft Visio "UML Model diagram" solution provides comprehensive support for creating object-oriented models for complex software systems. Includes the following tools, shapes, and functions:

N "UML Model Resource Manager", which provides a Tree View of the model and a means of browsing between views.
A predefined smart shape that represents elements in a UML annotation and supports creating a UML chart type. Under program control, the running Modes of these shapes are consistent with UML Semantics.
N is easy to access the "UML attributes" dialog box. You can add names, features, operations, and other attributes to the UML element through these dialog boxes.
N identifies and diagnoses errors (for example, loss of data or incorrect use of UML notation) for dynamic Semantic Error checks.
N performs reverse engineering on projects created using Microsoft Visual C ++ 6.0 or Microsoft Visual Basic 6.0 to generate a UML static structure model.
N use C ++, Visual C #, or Microsoft Visual Basic to generate a code framework based on the class definitions in the UML model.
N code check utility that identifies language-specific errors. These errors may make the code unable to be compiled using the target language you specified for generating the code.
N creates a report for the UML static structure, activity, status chart, component, and deployment diagram.

Model Resource Manager usage

When you open the "UML Model diagram" solution, you open a modeling environment and the model is in place from the beginning.

(Figure 1)

If "Model Resource Manager" is not displayed, click "UML"> "View"> "Model Resource Manager"

The Tree View in "UML Model Resource Manager" represents your overall system model. The charts you create are all views of this model.

  1. Indicates the system you are currently modeling. To add a model, click model on the "UML" menu ".
  1. In this case, a model or abstract content of your system is represented as a static structure model. To rename any icon in the Tree View, click the text of the icon once and then click the text again. Enter a new name.
  1. Indicates the top package in the static structure model. A package is a container. This package contains all static schema model elements.
  1. By default, the packages included in the new model contain common data types. You can create packages that contain your own data types.
  1. Click the plus sign (+) to display the package content. Click the minus sign to hide the package content.

The steps shown in figure (1) are as follows:

A. Change the default name of the top-level package to "petshop": Right-click and select "RENAME"

B. Change the package "static model" to "Design Model": Right-click and select "RENAME"

C. Name of other packages and so on

2. use case diagram

2.1 use case diagram Composition

The use case diagram shows the relationship between participants and use cases in the same system. Is a description of a set of action sequences (including its derivatives). The system executes the action sequence to generate an observed result value for the participants. In Visio, there are three parts:

    1. Role)

The initiator of the activity, which is used in Visio.

    1. Use Case)

In actual scenarios, such as logging into the system and entering the warehouse, represented in Visio.

    1. System boundaries

    The boundary of the system use case to determine the boundary between the system and the outside. It is represented by a rectangle.

2.2 create a use case diagram

Suppose (1) We have a warehouse system with three activities (Use Cases): warehouse receiving, warehouse picking, and inventory displaying items. check the inventory of items when warehouse is released. If the inventory is smaller than 5, the warehouse cannot be released. The executor of the activity is the Warehouse administrator (these are all from the requirement documents). When warehouse receiving and picking, the administrator needs to open a warehouse receiving and picking ticket. In this example, we mainly consider warehouse picking.

2.2.1 create a role)

In "Figure 1", select "actors package", right-click, select "main character", and enter "name", as shown in figure 2 and Figure 3:

Figure 2 Figure 3

2.2.2 create Use Cases

In Figure 1, select "usercases", right-click, select "Use Case", and enter "name", 4, as shown in Figure 5:

Figure 4 Figure 5

2.2.3 establish communication between roles and Use Cases

In visio:

2.2.4 establish the relationship between Use Cases

A. Usage relationship

  1. In the use case chart, drag the "use" link shape to the drawing page;
  2. Attaches the "use" endpoint (without arrows) to the connection point * in the "Use Case" shape using other use cases;
  3. Attaches the "use" endpoint (with arrows) to the connection point of the use case;
  4. Double-click the "use" shape to open the "UML inductive attributes" dialog box. Add the property value and click OK ".

B. Extended relationships

    1. In the use case diagram, drag the extended shape to the drawing page;
    2. Attaches the "extended" endpoint without arrows to the connection point + that provides the extended use case;
    3. Attaches the "extended" endpoint with arrows to the connection point of the basic use case;
    4. Double-click "extension" to open the "UML inductive attributes" dialog box. Add the property value and click OK ".

2.2.5 create a use case diagram

Select "usecase model" in Figure 1, right-click, and select "Use Case map". The default name is retained here. Then we can drag the created roles and use cases from the tree on the left to the blank area on the right. At the same time, we also need to establish the system boundary, from hypothesis (1) we know that the warehouse should check the inventory of items, so the use case "goods warehouse out" should use the use case "show the inventory of items" (the use case "goods warehouse out" is not complete without "show inventory ). For the use case "item warehouse", the Warehouse administrator can also check the inventory of items while entering the warehouse. Therefore, the relationship between the two is extended (the "goods warehouse" use case itself has complete functions, but the administrator can also view the inventory at some time. In addition, the Warehouse administrator can also directly view the inventory information. The following figure shows an example:

Figure 6
Note:For more information about how to create a Use Case chart, see the online help of Visio.

3. Create an activity diagram

3.1 composition of the activity diagram

    1. LANE: used to indicate the responsibility in the activity diagram. It is a rectangle;
    2. Status: indicates an activity or action, which can be divided into "action status", "status", "initial status", and "final status ";
    3. Control Flow: changes from one state to another.

3.2 Create an activity diagram

Follow these steps to create an activity chart for warehouse export:

    1. In Figure 1, select "usecases" and Right-click the package and select "activity diagram ";
    2. Drag the lane to the right and double-click the lane to rename it as "item warehouse picking ". Drag "initial status" from the left to the blank area on the right
    1. Drag the three "Action statuses" to the right and name them "apply for warehouse release", "select warehouse" and "Judge inventory" respectively, and then add control flow between the three;
    2. Drag the "Judgement" process to the right, add two control flows, and double-click the control flow to enter the critical expression: success and failure;
    3. Drag "final state" to the right. Two control flows in connection step 4.

The final result is as follows:

Note:1: The "merge" (from top to bottom third diamond) of the graph is the UML industrial standard, which is not supported by visio currently. 2: For more information about creating activity diagrams, see the online help of Visio.

4. Use of static structure digraphs

There are two types of static structure diagrams in Visio: Conceptual static structure diagram and class static structure diagram. Static conceptual structure diagram represents concepts in the real world and their relationships. It focuses on relationships and attributes, rather than methods, and helps you understand the terms in the domain for which the system is developed.

Static class structure diagram is to break down the software system into various parts. However, in the class diagram, each department refers to a class that represents a fully defined software entity, rather than an object that represents the concept of the real world. In addition to attributes and associations, class diagrams can also specify operations, methods, interfaces, and dependencies.

We will focus on the class static structure diagram.

Composition of 4.1 static structure charts

The static structure diagram of a class is composed of classes or objects. It is used in Visio to indicate that the relationships between classes are mainly correlated, and there are three types of dependency and induction:

Association is expressed

Dependency is expressed

Inheritance (induction) is represented

4.2 create a static class structure chart

In Figure 1, select staticview, right-click and select static structure chart, and drag the class icon from the right to the blank area on the right:

Figure 8

4.2.1 create a class

Drag the icon of the class from the left to the right. Enter the class name, attributes, and methods:

Figure 9 Figure 10 Figure 11

According to hypothesis (1), the warehouse system has the following classes:

Goodsoutput, goodsoutputitem, storehouse, product, manager, and storehousecontrol) and people are created in sequence.

4.2.2 establishing inter-class relationships

Through analysis, we know that a warehouse can contain many items, that is, the two are correlated (one-to-many ). Manager is inherited from people. Therefore, you can use an inherited image.

Link:

  1. Drag a "binary Association" shape from the "UML static structure" mold to the drawing page next to the class to be associated;
  2. Attaches the endpoint of the correlated shape to the connection point * of the shape;
  3. Double-click the "join" shape to open its "UML attributes" dialog box, and enter or select the attribute value to be set;
  4. Click OK ".

Inheritance relationship:

  1. Drag the inherited shape from the UML static structure mold to the drawing page next to the class or package to be associated.
  2. Attaches the endpoint next to the arrow to the connection point * of a more common element. Attaches the endpoint without arrows to the connection point of a more specific element.
  3. Double-click the "induction" shape. In the "UML inductive attributes" dialog box, add the name, constructor, and other attribute values, and click "OK ".

The static diagram is as follows:

Note:For more information about creating static structure charts, see the online help of Visio.

5. Create a sequence diagram

The sequence diagram shows the roles or objects involved in interaction and the events generated by them in chronological order. Generally, a sequence diagram shows the events generated by a specific use case instance.

The vertical dimensions in the sequence diagram represent the time, which is sorted sequentially by time. The horizontal dimension represents different roles or objects.

The following is a sequence diagram of the Use Case "goods warehouse picking" based on assumptions (1 ).

1. Select "usecase realization" in Figure 1 and right-click and select "sequence diagram ";

2. Drag "Object lifeline" into the blank area on the right, double-click "Object lifeline", enter the name "amanger", set "Classifier" to "repository administrator", and click OK. Such an object is created. Other classes in the static class structure are copied as follows:

3. Drag "activation" to "goodsoutput object lifeline". The processing method for other objects is similar;

4. Add "message (CALL)" to the two "activation. For example, for goodsoutput lifeline and storehouse lifeline, after "message (CALL)" is added, goodsoutput will create an instance of storehouse class. For example, first, we need to determine the goods in the warehouse, so here we call the corresponding method, we first drag the "message" from the left toolbar, and connect the corresponding activation, the result is shown.

5. double-click "Message 1". If the goodsoutput class does not have this method, the add method dialog box is automatically displayed. Because we have added this method, you can directly select the corresponding operation here, if a parameter exists, we can adjust the parameter name through the real parameter,

6. According to the assumption (1), the inventory of items needs to be checked during warehouse Export (the inventory cannot be obtained if it is smaller than 5). Therefore, storehouse needs a getproductstorage method to obtain the inventory of items;

7. After the inventory is returned, perform different calls based on the inventory. If the inventory is not smaller than 5, create a new goodoutputitem instance;

8. If the returned inventory is less than 5, use it to add and return "nothing added ". The final sequence diagram is as follows:

Note:For more information about creating sequence diagrams and other UML diagrams, see the online help of Visio.

6. Visio and Ms. net

6.1 Visio generate. Net code

The code generated from the UML diagram is called a forward project. In Visio, the. NET code can be easily generated.

1. Click "UML" option-> "code"-> "generate". A dialog box is displayed, in which the package for generating code is selected;

2. Select "Target Language" and "location", and click OK.

6.2 generate a UML diagram in Visio from. net

UML diagrams generated by code are called reverse engineering. In. net, you can easily generate UML diagrams.

    1. Open the. NET project and select "project"> "UML"> "reverse engineering:
    1. Enter the name of the Visio file to be generated. Click Save.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.