Procedures are a natural division of the program and therefore provide the best mechanism to represent program modularity.
The program should be organized or structured as a set of modules, each of which is written as a procedure.
Adhere to the following guidelines when using procedures:
- Write procedures with minimal dependence on their ability to access the values of their containing procedure. All such use
of nonlocal variables should be clearly documented by comments in both the declaring and the using procedures.
- Write procedures that are used only from within a given procedure as internal procedures within the calling procedure. Write
internal procedures following the executable statements of the containing procedure.
- Make each procedure as small as possible to enable understanding of program logic.