External Programming

As an alternative to programming in LF‑ET with the integrated source code editor, all source codes for a decision table can also be fully processed in any development environment, e.g. Eclipse, Visual Studio, JDeveloper, etc.

LF‑ET can generate a special ‘working source code’ for that purpose: the scrapbook.

The same path name and file name are used for the scrapbook as for the final (productive) source code, which is temporarily overwritten, if necessary.

Work steps for the external editing of source codes
  1. Generation of the scrapbook from LF‑ET

  2. Possibly: Transfer of the scrapbook to the development environment (Only if the scrapbook is not located in the development environment and the transfer has not been performed automatically)

  3. Editing of the source codes in the scrapbook with the full functionality of the selected development environment

  4. Possibly: Transfer of the scrapbook back to the ‘LF‑ET location’ (Only if the scrapbook is not located in the development environment and the transfer was not performed automatically)

  5. Synchronization of all changes by importing the scrapbook back into LF‑ET

As the same path name and file name are used for importing the scrapbook back into LF‑ET as for the final code, external changes to the productive code, e.g. those caused by refactoring, can easily be synchronized with LF‑ET.

Contents of this chapter:

What is a scrapbook?

A scrapbook is a fully compilable working source code that contains all source elements that are possible in a decision table:

Decision table prolog
Abort statement if the scrapbook is e­xe­cu­ted inadvertently
All conditions (in sequence, simply one after another)
All actions (in sequence, simply one after another)
Decision table trace code
Decision table error code
Decision table epilog

Individual source elements must be clearly separated by comment lines, e.g.:

// Prolog condition C01 ---->
// Prolog condition C01 <----

These comments are used both by the developer and by LF‑ET to identify where a particular source element begins and where it ends. For that reason, these comments must not be changed du­ring editing.

To minimize the amount of basic programming work, some of the mis­sing source codes are replaced by predefined statements:

  • The decision table prolog and epilog are filled in such a way that e.g. a class is created with a method

  • condition prologs remain empty, e.g. true is used for mis­sing logical arguments

  • mis­sing source codes for actions are only provided with one TODO comment

All automatically filled source elements are provided with a TODO comment which states that these source elements still have to be adapted to the tasks to be carried out (analyze system statuses, generate system statuses, etc.)

The important thing is: All the programming work can be done completely and without any restrictions in the developer’s customary development environment. Once all adjustments have been made, the changed source elements are read back into the decision table by means of the ‘Read scrapbook’ function and the final ap­pli­ca­tion source code can be ge­ne­ra­ted and tested

Example of a scrapbook

Generating a scrapbook

A scrapbook is ge­ne­ra­ted using the “Generate scrapbook” function to be found in the generation menu.

01

  • The generation menu can also be opened directly with the key combination CTRL+ALT+G.

  • Scrapbook functions are only available when the decision table has already been saved and the path name and file name defined for the scrapbook.

  • Important: When there are extended conditions, no logical arguments should be defined for the final value (the ‘else value’), just as in the case of ‘no value’ of a restricted condition. That is why no section for a mis­sing logical argument is ge­ne­ra­ted du­ring scrapbook generation for the final value of a condition.

Importing a scrapbook

Once you have finished editing the scrapbook, all changes are synchronized as a result of the scrapbook being read back into LF‑ET:

01

Hints and tips:

  • As the same path name and file name are used for importing the scrapbook back into LF‑ET as for the final code, external changes to the productive code, e.g. those caused by refactoring, can easily be synchronized with LF‑ET.

  • The generation menu can also be opened directly with the key combination CTRL+ALT+G.

When is it worth using the scrapbook?

Minor changes to source codes that can easily be made without the support of a development environment are best handled directly in LF‑ET using the integrated source code editor.

When bigger or more difficult changes are to be made, or when source elements are created for the first time in a newly ge­ne­ra­ted decision table, it is normally worth taking the ‘detour’ via the scrapbook.