Reverse Engineering Source Code

Even if coding is underway, you can use UML diagrams to better understand a project. If you develop projects in Microsoft Visual Studio 2005 you can reverse engineer your Visual C++, Visual C#, or Visual Basic projects’ class definitions and generate UML static structure models in the Model Explorer. If you have Visio Professional 2007 installed, Visual Studio 2005 includes the Microsoft Visio UML Add-In, which you can run from within a Visual C++, Visual C#, or Visual Basic project. The add-in provides a menu command similar to the one shown in Figure 20-15. With the menu command or the associated toolbar button you can open Visio Professional 2007 and start a new diagram based on the UML Model Diagram template from within Visual Studio 2005, as well as reverse engineer source code. After you reverse engineer a project, you can create a class diagram in Visio Professional 2007 by dragging elements from the static structure model onto the drawing page.

Figure 20-15. The UML add-in adds a menu command to Visual Studio.


The Visio UML add-in can reverse engineer the following language constructs: classes, user-defined types, enumerated types, member functions, member variables, and method parameters.

Follow these steps to reverse engineer Visual C++, Visual C#, or Visual Basic source code:

1.
Build the project in Visual Studio 2005.

Note

Make sure your Visual C++ project includes header files for your classes. If your Visual C++ project doesn’t have a header file for a class, that class will not appear in the model that Visio Professional 2007 reverse engineers.

2.
In Visual Studio 2005, choose Project, Visio UML, Reverse Engineer (or click the Reverse Engineer button on the Visio UML toolbar).

Select the Visio UML file when prompted and click Save. Visio opens a blank static structure diagram drawing page and the Model Explorer, which is populated with elements that reflect the class definitions in the source code.

3.
To create a static structure diagram, drag elements from the Model Explorer onto the blank static structure diagram drawing page.

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

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