Step-by-Step Guide to Reverse Engineering Code into UML Diagrams with Microsoft Visio 2000This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Microsoft Certified Partner
Microsoft Visio 2000 Enterprise Edition
Microsoft Visio 2000 Professional Edition
Summary: Microsoft Visio 2000 Professional and Enterprise Editions include technology for reverse engineering from Microsoft Visual C++, Microsoft Visual Basic, and Microsoft Visual J++ code into Unified Modeling Language (UML) class diagram models. The steps for reverse engineering from each language are discussed in this article. (9 printed pages)
Step 1: Customize the Development Environment
Step 2: Open the Code Project to Reverse Engineer
Step 3: Select the Reverse Engineer Button
Step 4: Create your UML Diagrams in the Visio UML Model DiagramSolution
Microsoft® Visio® 2000 Enterprise Edition and Professional Edition both include solutions for reverse engineering code into UML static structure diagrams. Three languages are supported by the solutions: Microsoft® Visual C++® 6.0, Microsoft® Visual Basic® 6.0, and Microsoft® Visual J++® 6.0. The version of UML standard employed by the Visio UML Model Diagram Solution is 1.2.
The reverse engineering technology used varies for each language. For J++ and Visual Basic, the solution uses the object model of the development environment to collect the static structure information. For C++, the solution uses the browse information file (.BSC) as the source of the structure information. Although Visual Basic and J++ reverse engineering both use the object model of the development environment, the J++ object model exposes more complete information and gives a more complete reverse engineered UML model. The browse information file in C++ contains the least information; therefore, the resulting UML models will not be as complete as the ones obtained through J++ and Visual Basic reverse engineering.
This article presents the steps required to reverse engineer into the Visio UML Model Diagram Solution.
Note The Visio UML Model Diagram Solution supports reverse engineering only for Microsoft Visual C++ 6.0, Microsoft Visual J++ 6.0, and Microsoft Visual Basic 6.0. Service Pack 3.0 for Microsoft® Visual Studio® must be installed to use the Visio UML Add-In.
The major steps required to reverse engineer your code into the Visio UML Model Diagram Solution are as follows:
- Customize the Visual Studio development environment
- Open the project to reverse engineer in Visual Studio
- Select the Reverse Engineer button from the Visio UML Add-In toolbar
- Create the UML class diagrams in the Visio UML Model Diagram solution
The remainder of this article provides detailed instructions for each step, including information specific to programming language. For example, customizing the development environment will have a corresponding section for Visual C++, Visual Basic, and Visual J++.
In order to reverse engineer, the first step is to customize the development environment by adding the Visio UML Add-in toolbar. The following instructions show how to add the toolbar to the different environments in Visual C++, Visual Basic, and Visual J++.
To customize Microsoft Visual C++ 6.0
- In Visual C++, select Customize from the Tools menu.
- In the Customize dialog box, select Add-ins and Macro Files tab.
- From the Add-ins and Macro Files list, select Visio UML Add-in from the list of Add-ins and macro files. Make sure that a checkmark exists next to it, and then click Close.
- The floating, five-button Visio UML Add-in toolbar appears.
Tip If you want the toolbar to be available each time you open Microsoft Visual Studio, dock the toolbar by dragging it to the toolbar area.
To customize Microsoft Visual Basic 6.0
- In Visual Basic, choose Add-In Manager from the Add-Ins menu.
- In the Add-in Manager dialog box, select Visio UML Add-in from the Available Add-Ins list. For Load Behavior, select Loaded/Unloaded and Load On Startup, and then click OK.
- The four-button Visio UML Add-in toolbar appears.
Tip When the Visio UML Add-In creates the toolbar, it also adds commands to the Tools menu. You can locate the commands by selecting Tools from Visio UML Solution.
To customize Microsoft Visual J++ 6.0
- In Visual J++, choose Add-In Manager from the Tools menu.
- In the Add-In Manager dialog box, select Visio UML Solution from the Available Add-Ins list. For Load Behavior, check Loaded/Unloaded and Load On Startup, and then click OK.
- The four-button Visio UML Add-in toolbar appears.
Tip When the Visio UML Add-In creates the toolbar, it also adds commands to the Tools menu. You can locate the commands by selecting Visio UML Solution from the Tools menu.
The reverse engineering process is initiated from within the development environment for all three languages. After you have customized the environment by adding the Visio UML Add-In, the next step is to open the project that you wish to reverse engineer.
Additional Steps for Visual C++ 6.0
For Visual C++, there are several additional steps required before proceeding with the reverse engineer. The first step is to generate a browse information file (.BSC) for your project. Instructions for generating the browse file are included below. The second step is to determine which code libraries to include in the reverse engineer. Instructions for setting these options follow the browse file instructions. Finally, you should build the project before reverse engineering.
To generate a browse information file for Visual C++ 6.0
- In Visual C++, choose Settings from the Project menu.
- In the Project Settings dialog box, choose the type of build configuration you want, click the C/C++ tab, and then check Generate browse info.
- Click the Browse Info tab to specify the name and location of the browse information file, check Build browse info file, and then click OK.
To choose libraries to be included with Visual C++ 6.0 reverse engineer
- Click the Visio UML Options button on the UML Add-in toolbar to set which libraries to include with the Visual C++ reverse engineer.
- This brings up the Visio UML Options screen. If you wish to have information included in the reverse engineer from MFC Classes, ATL Classes, or Standard Include Files, simply place a check next to the desired option, and then click OK.
The next step for reverse engineering is to select the Reverse Engineer button from the Visio UML Add-in toolbar.
For Visual Basic and Visual J++, this will open Visio 2000 to the UML Model Diagram Solution with the information reverse engineered into the model. The UML Model Diagram Solution will open with a blank static structure diagram and a tree view in the UML Navigator containing the model information collected from the project.
For Visual C++, you may be presented with two additional screens before Visio 2000 opens with the project information reverse engineered into the UML Model Diagram Solution. If more than one project exists in the Visual C++ workspace, you can select the project you want to reverse engineer in the Select Project dialog box, and then click OK.
If more than one browse file is present in the project hierarchy, select a browse file in the Select Browse File dialog box, and then click OK.
Now your project information should be in Visio 2000. In order to create the UML class diagrams, drag-and-drop model elements from the UML Navigator onto the Static Structure diagram. The class relationships (generalization, realization, binding) will be displayed automatically. With the Visio UML Model Diagram Solution, you can create additional UML artifacts to specify, construct, visualize, and document your software project.
For More Information
You can also visit the Visimation Web site.
Visimation specializes in Visio consulting, custom development, training, and services.