Book a Demo
Prev Next


This topic provides answers to frequently-asked questions relating to code generation and reverse engineering of code in Enterprise Architect.



See also

Can Enterprise Architect Generate Source Code From Behavioral Diagrams?

Yes, in the Unified and Ultimate Editions you can generate software and hardware code from Behavioral models. All behavioral constructs must be contained within a Class.

In both Editions, you can generate software code from StateMachine diagrams, Interaction (Sequence) diagrams, and Activity diagrams. You can also generate code in a range of languages, including C(OO), C#, C++, Java and VB.Net.

In the Unified and Ultimate Editions, you can generate hardware code from StateMachine diagrams. You can generate code in various Hardware Description Languages, including VHDL, SystemC and Verilog.

For information on how to generate code from Behavioral models in Enterprise Architect, see the Behavioral Models Help topic.

Behavioral Models

Can Enterprise Architect reverse engineer to a Sequence diagram?

Sequence diagrams cannot be reverse engineered directly from source code (or from Class models), but they can be recorded by running your application under Enterprise Architect's integrated debugger and then selecting specific code break points to record the sequence. The reasoning for this is that any reasonable-sized application will produce an overly-complex Sequence diagram that will not be readable. Hence the need for users to select key sections of code to generate the diagrams.

Examples - including a Class model, build scripts and related source code - can be generated in your model using the Patterns window (Develop > Source Code > Create from Pattern), selecting an example from the 'VEA Examples' page.

For more details see the Samples Help topic.

Also see the Using the Visual Execution Analyzer in Enterprise Architect webinar.

Using the Visual Execution Analyzer in Enterprise Architect Samples

Can I write my own code generation templates?

You can write your own code templates for generating code from Class models (and from Behavioral models). This involves using the Code Template Framework. As a starter for this process you must define a Datatype for the new language.

Data Types Code Template Framework

Can I write my own code reverse engineering templates?

If you are familiar with using nBNF for code syntax notation, you can write a grammar for reverse engineering a language that is not supported by Enterprise Architect.

To start with this, see the Grammar Framework Help topic.

For nBNF samples see:

C:\Program Files (x86)\Sparx Systems\EA\Code Samples\Grammar_Samples

Grammar Framework