next up previous contents
Next: Example Up: Program layout Previous: General requirements

Pseudo-code

  It is very difficult to define the pseudo code exactly. In general pseudo code will change from person to person. However, it is still wise to use the same type of pseudo code in each subroutine. In this section we shall give some suggestions of how a pseudo code may look like.
In case of a mathematical description of algorithms, use the same notation as would be used in an article. Use lines above and below a formula to indicate super and sub indices. Symbols that do not belong to the standard ASCII set, should be translated in a unique way, for example:
sqrt
sum
For example the matrix-vector multiplication A x = y can be defined by

     y  = sum a   x
      i    j   ij  j
In order to describe a standard source code we use a structure that resembles that of a structure diagram, including the indenting of texts. Of course the lines in the structure diagram are neglected.
Control structures may be described in the following way:

In general it is advised to give the general line of the algorithm in a descriptive form, with the neglection of non-relevant details. Do not use program dependent issues. If the pseudo code is in detailed form, use FORTRAN/PASCAL like code, i.e. formulas using + - / and ().
Assignment is indicated by :=, in conditions >, >=, < and <= may be used. In the pseudo code we do not distinguish between integers and reals, all numbers are exact.
Remark 1: If the formulae or the algorithm are so complicated that it makes no longer sense to put them in the source code, it is sufficient to refer to a document containing the complete description. Of course this document must be available with the source code.
Remark 2: The purpose of the pseudo code is to give a clear description of the algorithm. It is not the purpose to describe each statement in the pseudo code. However, the pseudo code must be such that an arbitrary programmer may code the subroutine immediately from the pseudo code.


next up previous contents
Next: Example Up: Program layout Previous: General requirements



ISNaS ontwikkeling
Wed May 24 08:37:14 METDST 1995