Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Initial Code

The 'Initial Code' screen is used to enter the code that is inserted into an operation Body when that operation is initially generated to file. After this point, the initial code is no longer referenced during forward code generation and synchronization. This code is most useful when combined with Design Patterns; elements within a Pattern often require the same stub code. The initial code is also useful for ensuring that the generated code is directly compilable. The language-specific Patterns available from the web site resources include initial code for some of the defined operations; this helps speed up the process of applying Patterns from model to implementation.

By default, the initial code also is not imported into the model during reverse engineering, but you can select to import the code by ticking the 'Include method bodies in model when reverse engineering' checkbox on 'Attribute/Operations' page of the 'Preferences' dialog.


Project Browser | Right-click on Operation | Operation Properties > Behavior: Initial Code

On the 'Initial Code' screen, type in the code to use on initial generation. When you have finished entering code, click on the OK button.

On the 'Behavior' tab, the Initial Code button shows an asterisk (*) indicating that initial code exists for the operation.


Design > Element > Operations > Behavior : Initial Code

Context Menu

Right-click element in diagram | Features and Properties | Operations | Behavior : Initial Code  or

Right-click element in Project Browser | Operations | Behavior : Initial Code  or

Right-click operation in Project Browser | Operation Properties | Behavior : Initial Code

Keyboard Shortcuts

F10 > Alt+B : Initial Code


In Project Browser, double-click on an Operation | Behavior : Initial Code

Learn more