2.6 Implementation

Now the simple model, and the graphical user interface is finished. It is now time to put the fragments together and build the final application.
The final element needed is an executable BETA program. The files made so far are what is called lib files. These files can be seen as personal additions to the standard patterns and objects in the basic environment (betaenv), and can be used in the same way in the BETA program, if included.

To make the Beta program, use the source code editor and select New BETA program in the File menu. This will generate a new BETA program. Again it will ask for a name, We called it MyProgram.

[6kb 239x247 GIF]

If you look at the fragments window in the upper right corner of the code browser, you will notice that, instead as in the MyShop file (the model file) and MyGUI file (The GUI file), where it said either lib: Attributes and Guienvlib: Attributes, it now says Program: Descriptor.

To include the lib files in MyProgram's environment, they have to be inserted into the fragment list, which is shown in the upper right corner of the code editor. This is done by using either Edit ORIGIN, INCLUDE etc. in the Fragments menu.

[7kb 289x218 GIF]

A sub editor will appear

[8kb 508x196 GIF]

Inserting new text into the fragment list, is now done by first using the Show Optional Non terminals in the Edit menu or pressing <CTLR> and <l> this will prompt an non terminal (Non terminals are always shown as << NonTerminal>>),

[8kb 508x196 GIF]

in which it is possible to write the the additional text, Highlight the optional non terminal as shown above, and start writing, the code editor will then automatically go into Edit text mode, this mode can also be entered by using the shortcut <CTLR> and <SPACE>. The text which should be inserted is:
INCLUDE 'MyShop';
INCLUDE 'MyGUI';
To get out of Edit Text mode simply press <CTLR> and <SPACE> and the fragment list should then look like

[8kb 508x196 GIF]

When the files are included, this window can now be closed down. And you should now turn to the code editor.

[17kb 790x614 GIF]

First make the program af subclass of GUIenv, by highlighting the <<Prefixopt>> like shown above, and writing 'guienv'.
then to make use of the windows designed earlier in this tutorial, we want to make instances of the first an instance of the sales window. Now highlight the <<AttributeDeclOpt>> either by using the arrow buttons or with the mouse. Then write 'MyShopWin: @MyShopWindow;', the program should now look like this

[2kb 507x100 GIF]

To insert an instance of the Administration window, highlight like above and simply press <ENTER>, this will make a new <<AttributeDeclOpt>>, like shown here

[2kb 491x88 GIF]

To make the instance of the Administration window, simply write as shown bellow.

[3kb 479x117 GIF]

Now there is an instance of the MyShopWindow and an instance of the MyAdminWin.These instances of windows will not be opened without a call to the open method in the Window pattern.

2.6.1 Browse Code

The Code editor, can also be used to browse the code, which will comes in handy, as soon as the programs gets bigger. In the example above with the windows, if you are curious about what the open method does. The normal thing to do is to track the actual window pattern by opening the files, in which it is inherited from, this can be a time consuming affair. In this editor simply, double click on either the MyShopWindow or the MyAdminWindow, and the browser will go to the file in which the window pattern is declared. Before this can be done the code has to be checked by Mjølner, to do that all the Optional Terminals has to be removed, this is done by using the shortcut  <CTRL> and <n> to Remove Optional Terminals. When the Terminals have been removed simply double click on MyAdminWindow. You will be asked if you want to check the code. If the code is checked the browser will now find the declaration of the MyAdminWindow, in the 'MyGUI' file.

[4kb 375x326 GIF]

Now the open method can be shown by double clicking on the three dots, this will show the virtual pattern open. Again if you want to see the virtual method declaration just double click on open

[2kb 147x72 GIF]

and Mjolner will follow the virtual binding, up the hierarchy.
Now to get back, use the Back shortcut <CTRL> and <b> or right click and use the menu.
Among many other features, the menu View gives the programmer the opportunity to make the view of the code as an overview, abstract, Detail and Detail Recursively, these features makes it easier to comprehend and overview large programs.

2.6.2 Edit Code

In the startup phase of the implementation of the BETA program, the Optional Terminals, as used above, is a great help, to make the the program structured right.
Now look at a do part

[2kb 133x106 GIF]

by right clicking on the optional

[4kb 242x255 GIF]

A list of imperatives will appear, ex a simple If Imperative, which will make an the structure for a simple If imperative. Like shown below

[2kb 448x120 GIF]

It is now easy to write the if imperative.
These optionals, as written earlier, is a big help to the programmer in the startup phase. When the actual programming is finished and only editing on the code is made, the shortcut <CTLR> and <SPACE> or using the Edit Text in the Edit menu, will make it possible to edit the highlighted code.

Good luck with your use of the Mjølner tools.


Mjolner Integrated Development Tool - Tutorial
© 1991-2002 Mjølner Informatics
[Modified: Friday August 17th 2001 at 15:56]