How to Reverse Engineer UML from Python?
Instant reverse is a process to produce UML class model from a given input of source code. With instant reverse, you can reverse a snap shot of your code-base to UML classes and form class diagram in further. By bringing code content into visual UML model, this helps programmers or software engineers to review an implementation, identify potential bugs or deficiency and look for possible improvements. Apart from this, developers may reverse a code library as UML classes and construct model with them, like to reverse a generic collection framework and develop your own framework by extending the generic one. In this chapter, we will go through the instant reverse of Python.
Reverse engineering UML classes from source files
- Select Tools > Code > Instant Reverse... from the toolbar.
- In the Instant Reverse window, select Python Sourse as the Language.
- Specify the path of the source file or the folder that contains those files.
The Instant Reverse window - You can place reversed classes to specific model. For example, to place legacy code to a model named Old, to place system prototype to a model named Prototype and so forth. To do this:
- Click on the ... button at the end of the Reverse to Model row.
- In the Select Parent Model window, either select an existing model, or create one by clicking New Model.
- Click OK to confirm.
- Click OK to start reversing.
- Upon finishing, you will see the Instant Reverse Form Diagram window appear. If you want to form a class diagram with the reversed classes, select the classes to form diagram, configure the options and click OK to proceed. Read the next section for detail. If you do not want to form diagram now, click Cancel to exit.
NOTE: By cancelling from forming diagram, it just means you do not want to form diagram with the reversed classes for the time being.
You can still look for the classes in Model Explorer or Class Repository, and possibly form diagram later on manually.
Overview of Instant Reverse
The instant reverse window |
|
||||||||||||||||||||||||||||||
Overview of instant reverse window |
Forming class diagram from reversed classes
By the end of an instant reverse operation, you will be asked whether or not to form a class diagram with reversed UML classes. By selecting classes and configuring the way to present them and confirm, a diagram will then be formed.
The Instant Reverse Form Diagram window |
NOTE: | If you do not want Visual Paradigm to ask you for forming diagram next time you perform instant reverse, uncheck Show this window after instant reverse. |
Below is a description of this window, base on the tabs.
Select Class
The classes listing in the tree are those reversed from your code-base. You must select at least one class in order to form a class diagram. Notice that forming diagram can be a costly operation if you have selected too many classes in forming diagram.
Form Diagram Options
|
||||||||||||||||||||||
Description of form diagram options |
Presentation Options
|
||||||||
Description of presentation options |
Reverse engineer package diagram from source files
By reverse engineering package diagram from source files, UML packages and the relationships in between will be produced.
- Select Tools > Code > Instant Reverse... from the toolbar.
- In the Instant Reverse window, select Python Sourse as the Language.
- Specify the path of the source file, or the folder that contains those files.
The instant reverse window - Select Package Diagram for Reverse To:.
- You can place reversed packages to specific model. To do this:
- Click on the ... button at the end of the Reverse to Model row.
- In the Select Parent Model window, either select an existing model, or create one by clicking New Model.
- Click OK to confirm.
- Click OK to start reversing.
Related Resources
The following resources may help you to learn more about the topic discussed in this page.
9. Reverse engineering of PHP 5.0 source files | Table of Contents | 11. Reverse engineering of Objective-C |