Prev Next

Importing Source Code

The ability to view programming code and the models it is derived from at the same time brings clarity to the design of a system. One of Enterprise Architect's powerful code engineering features is the ability to Reverse Engineer source code into a UML model. A wide range of programming languages are supported and there are options that govern how the models are generated. Once the code is in the model it is possible to keep it synchronized with the model regardless of whether the changes were made directly in the code or the model itself. 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.

The representation of the programming code as model constructs helps you to gain a better understanding of the structure of the code and how it implements the design, architecture and the requirements, and ultimately how it delivers the business value.

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 immediate relationships between that Class and 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.

Several options guide how the code is reversed engineered, including whether comments are imported to notes and how they are formatted, how property methods are recognized and whether Dependency relationships are created for operation return and parameter types.

Copyright Ownership

Situations that typically lend themselves to reverse engineering tend to operate on source code that:

  • You have already developed
  • 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.

Supported languages for Reverse Engineering

Language

See also

Action Script

ActionScript

Ada 2012 (Unified and Ultimate editions)

Ada 2005

C

C

C #

C#

C++

C++

CORBA IDL (MDG Technology)

www.sparxsystems.com/resources/mdg_tech/

Delphi

Delphi

Java

Java

PHP

PHP

Python

Python

SystemC (Unified and Ultimate editions)

SystemC

Verilog (Unified and Ultimate editions)

Verilog

VHDL (Unified and Ultimate editions)

VHDL

Visual Basic

Visual Basic

Visual Basic .NET

Visual Basic .NET

Notes

  • Reverse Engineering is supported in the Professional, Corporate, Unified 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

Learn more