Reverse Engineering

 < Day Day Up > 



Generating Source Code

Describe™ lets you generate C++ source code from class diagrams. I recommend generating code early in the design process to ensure your class properties are properly set. Once you get the settings just right you can generate your code framework with confidence.

Start the code generation process by opening a class diagram and selecting the classes you want to generate code for. Figure 20-23 shows a detailed robot rat application class diagram opened with all the classes belonging to the Remote Controlled Object package selected.

click to expand
Figure 20-23: First Step to Generating Code: Select Class Diagrams

When you have selected the classes go to the Tools menu and select Generate Code as is shown in figure 20-24.

click to expand
Figure 20-24: Generate Code Menu Item

You will be presented with the Code Generation dialog shown in figure 20-25.

click to expand
Figure 20-25: Code Generation Dialog

From the Code Generation dialog you can select the target language, which classes to generate code for, and Script Options. Take note of the Script Options portion of the Code Generation dialog. Script Options lets you check or uncheck different code generation options. Some of the options include the automatic insertion of a copyright comment, automatic generation of constructor and destructor functions, and automatic generation of get and set methods for class attributes. Getting code generation just right for a complex C++ application takes some skill and a little trial- and-error. Once you get the settings of your classes, their related attributes and functions, and the code generation options just right, Describe™ does a pretty good job of generating the application framework code. You, of course, must add the guts to the operations to get everything running properly.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net