04-03-2013, 12:52 PM
C++ Reverse Engineering Tutorial
C++ Reverse Engineering.pdf (Size: 539.38 KB / Downloads: 84)
Introduction to Reverse Engineering
The reverse-engineered code produces a complete UML Class Diagram. All objects also have all of their attribute information completely filled in from the source code.
The procedure outlined here can be used on any language and methodology. The best way to evaluate Describe's reverse-engineering capabilities is by running your own code through it. Describe provides detailed and comprehensive support for reverse-engineering source code. Both header files and body files can be reverse-engineered.
C++ Reverse Engineering Overview
The primary purpose of reversing C++ code is to look at the structure of the classes from an analysis and design perspective. When you reverse C++ code using Describe a new system is created with two views, the view describing the classes is an Class Model view and the other is the Implementation Model view.
When Describe reverses C++ classes, the information about each class attribute is complete and there is no loss of any class information. Embedded information within the C++ class is maintained in the class object on the diagram. In this manner, all implementation details, those details that are not supported by a methodology, are stored for later use by code generation.
The Implementation Model is used to provide the second view that is generated when some C++ code is reverse engineered. It is a model used to represent all the files used in a reversed system. This includes both user and system include files. This model is used to provide support for seamless generation of C++ code from the system, minimizing adverse changes to the reversed code.
The Implementation Model represents all the files for a system in a hierarchical, left to right layout. For example, you can have a single C++ file representing a piece of legacy code. This file might include a single header file. That header file, however, can include quite a large number of files, one doesn’t really know until they examine the include structure. Describe reverse engineering follows these includes and track them completely, showing you the resultant include hierarchy on an Implementation Model view.
The Implementation Model does more than show a file hierarchy, it also holds all the non-class related information needed to regenerate the code. For example, each file object in this model stores what classes were generated from it enabling code generation to generate code for the classes back into the same files.
Comment Capture
The reverse engineering process will capture comments from the source code and add them to the model as class, attribute and operation descriptions. The forward engineering process applies the current descriptions from the model to the source when doing code generation. Most comments which precede or are contained by a C++ class definition are preserved. Most comments appear as part of a class symbol in the class diagram and can be viewed and edited using the Describe attribute editor. Preserved comments will appear in reports and in code generated during forward engineering.