Importing Source Code

When modeling in Enterprise Architect, it is possible to import - reverse engineer - existing source code as a single directory or a directory structure, in a variety of code languages, into your UML model. By reverse engineering code you can examine, for example, the functionality of code libraries for reuse, or bring the UML model up to date with new code from outside the model; that is, synchronize the code and model. The code structures are mapped into their UML representations; for example, a Java Class is mapped into a UML Class element, variables are defined as attributes, methods modeled as operations, and interactions between the Java Classes represented by the appropriate connectors.

By examining the code in a UML model, you can identify the critical modules containing the code, providing a starting point for understanding the business and system requirements of the existing application and a framework for gaining a better overall understanding of the source code.

You have several options in performing reverse engineering, including:

•

Whether comments are reverse engineered into Notes fields, and how they are formatted if they are

•

How property methods are recognized

•

Whether dependencies should be created for operation return and parameter types

It is important to note that if a system is not well designed, simply importing the source into Enterprise Architect does not turn it into an easily understandable UML model. When working with a poorly designed system it is useful to assess the code in manageable units by examining the individual model packages or elements generated from the code; for example, dragging a specific Class of interest onto a diagram and then using the Insert Related Elements option at one level to determine the Class's immediate relationships to other Classes. From this point it is possible to create Use Cases that identify the interaction between the source code Classes, providing an overview of the application's operation.

Is part of a third-party library that you have obtained permission to use

•

Is part of a framework that your organization uses

•

Is being developed on a daily basis by your developers

If you are examining code that you or your organization do not own or do not have specific permission to copy and edit, you must ensure that you understand and comply with the copyright restrictions on that code before beginning the process of reverse engineering.

In the Corporate, Business and Software Engineering, System Engineering and Ultimate editions of Enterprise Architect, if security is enabled you must have Reverse Engineer From DDL And Source Code permission to reverse engineer source code and synchronize model elements against code

•

Using Enterprise Architect, you can also import certain types of binary files, such as Java .jar files and .NET PE files

•

Reverse Engineering of other languages is currently available through the use of MDG Technologies listed on the MDG Technology pages of the Sparx Systems website