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 UML 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 the Options dialog.
Access 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.
|·||UML Patterns (Online Resource)|