This lecture will discuss how to use Microsoft Visio Professional 2003 to create UML charts. Additional discussions on these charts will appear in other lecture notes. There are several books on the market that go into detail on how to use Visio, if you find that necessary. Generally, I have found that these books contain far more information than is needed for these lectures.
I have noticed that Visio 2003 installed on different computers have some of the tool bars in other locations than you will see in these graphics. You may have to experiment to find some of the tools. Look under Tools or Format on the menu bar for additional tools that may not appear like these graphs on your copy of Visio 2003.
During these lectures, you will be provided with a brief introduction to the Unified Modeling Language (UML). Among other things, by using UML it is possible to depict structures, classes, instances of structures and objects of classes. Visio can be used to create UML diagrams. For example in this lecture, the design of a class called Company was depicted as the following
The data type Company will have the following fields:
name - string
owner - string
address - string
city - string
state - string
zip - string
The methods for Company:
input: name, owner, address, city, state and zip code
output: company information.
UML data type description:
The diagram above was done using a table. However the class Company can be depicted using Visio. To do this, open in Visio to a blank screen. In the Category menu bar select Software. When you do, a collection of options appear in the Templates on the right. One of these options is UML Model diagram (US units). Select this template. On the left will now appear a selection of UML graphics including Class. What you should see is something like the following graphic:
If the left hand side does not look like the above graphic, you may need to click the UML Static Structure (US units) option. Instead of being above the drawings as in the above graphic, this option may be below the graphic images. Once you have this available and you see these graphic images drag a copy of the Class onto the graphic. When you do it will appear like the following:
Double click on the Class 1 option and when you do the following should appear:
In the textbox: Name type in Company. In the Categories menu on the left, double click on the Attributes. When you do you, the attributes' option should appear. (In C# the attributes are called: fields.) Type in the field names: companyName, companyOwner, companyAddress, companyCity, companyState and companyZip. Once you do, you should have the UML Class Properties appear as in the graphic below (unfortunately the names are not completely visible but this can be overcome for any of the columns by moving your mouse to the vertical line between the columns and moving the line to make any column larger.):
For the Type select C#::string. When you have completed these steps, the UML Class Properties dialog box should appear as the following. To complete this step, click the OK button.
On the left the Model Explorer should list the class name with the names of the fields listed below as the following:
The Class diagram for Company on the grid should appear as:
Double click on Company in the Model Explorer on the left. This time double click on the Operations menu option. In the Operations column type enter the name of each of the following methods: inputName, inputOwner, inputAddress, inputCity, inputState, inputZip, outputCompanyInfo. When you do, the following should appear:
Select C#::void as the output for the first six of these operations and C#::string for outputCompanyInfo. You should now see something like the following graphic:
Once the names are in, click the OK button. In the Model Explorer you should see:
However the arguments for the operations are missing. For an example on how to place those items on the UML graph, click on the operation inputName. Next click on the button labeled: Properties.
When you do, you should get a dialog box like the following:
When you do this the following dialog box appears:
Next click in the blank in the column below the word: inputName in the column headed: Parameter. Type in the word: name and select as the Type: C#::string.
When you do this step, you should see the following:
For inputOwner enter owner, inputAddress enter address, inputCity enter city, inputState enter state and for inputZip enter zip.
For each of these operations, you should select for the Type: C#::string. After you have done this process for each method, notice that there is a column labeled: Kind and that each argument has by default the word: in. This term means that the argument is moving data into the method's body using this parameter. Other options for Kind are: out and in/out. To complete this process, click the OK button. In the graph is now the UML diagram for the class Company and it should appear like the following. Once the graphic is completed save it as Company.VSD and then as Company.jpg:
Now do the same thing for the class Date and the class Sales from the Lecture 1 design example. Do these two classes on the same graph. The difference between this graph and the previous one is that the class Sales is derived from the class Date. Therefore you would need to connect the two class UML diagrams together with an arrow pointing from Sales to Date and the name of the bottom class should be: Sales:Date as in the following graph:
Save this UML diagram as: Date_Sales.VSD and then as: Date_Sales.jpg. Remember to always save in both file types. The .VSD type may be used if it is necessary to redo a Visio graphic.