VocExile/Programming Topics/Computer Program Structure
by Ed Perley
Consider how the operation of a complex industrial machine differs from that of a computer program. First of all, the machine has one or more control panels that give an up to the minute picture of what the machine is doing. If something goes wrong, a trained technician can spot the problem. Usually he can fix it by changing settings on the control panel. Or, if a component fails, he can either plug in a new one or switch to another one. Since all of the sockets have specific shapes, there is no danger of plugging a component in the wrong socket. Usually, all corrections can be made without turning the machine off or by spending hours examining diagrams of the machine's components.
It occured to me that it should be possible to design computer programs that have the above mentioned features. Some of my ideas are discussed below. There are three distinct parts to this system of programming, which are described below.
Temporary global variables are used to pass information to and from program functions or modules. They consist of global arrays of variables, one for each data type that the program will need to use. In languages that use pointers, there can also be an array of pointers. The names of these variables would be standard, ie. all programs with this type of design would use these same variables.
If properly implemented, this system could minimize errors resulting from mismatched varible types and confusion about whether variables need to be local or global. These properties also will make it easier to use a module in other programs with no modification.
The control module and control panel control all calls to functions and modules in a program.
Every module and function in the program is assigned a number. No program module is called directly. Instead, the appropriate number is placed in a temporary integer variable, and the control module is called. All calls for functions and program modules are made through the control module. This system could conceivably be extended to call separate programs if there is a means to pass variables to them.
The Control Panel is a screen display of all of the modules that are called in the program. It can be used to turn a module off or on, or to substitute a different module to do the required task. And this can be done while the program is running. It will also display basic documentation for each module, saying what is it's purpose, what modules it calls, and what global variables it needs to read and write to. It will also display a status code for each module.
On the Programming Menu (Link is shown below) is a link to my report on the design of a Surface View program, using a program structure similar to this one.
The logic module will control any program logic that may need to be modified when the program needs to debugged or upgraded. Like the control module above, it will have its own control panel. It will use a system something like my discussion on logic tables (Use the link to the Programming Menu below.)
There will be future discussion on this design in the future. I have been advised that there are some problems with this plan that should be addressed.
* I changed the term standard global variables to temporary global variables. I like it better.
To Programming Menu
To Main Menu