Modular Programming

See also Programs are Algorithms and Program Structures

Modular Programming

A major advantage of the modular approach is that modules can be reused (shared) within and between programs. Some characteristics and rules
  1. Modular programs are hierarchical.  That is to say, there are higher and the lower level modules. (see diagram below)
  2. The top-level Control Module makes all major decisions regarding flow of control through the program. (see Pseudocode below)
  3. Modules have only one entry point and one exit point (excepting legal violations.  See Program Structures).
  4. A module can only be invoked (called) from a high level modules.
  5. On exiting a module control is returned to the statement immediately following the invocation.
Pseudocode
       Start  Program
              Start Control Module
                     Do Initialise
                     Do Program Body
                     Do Terminate
              End control module.

               Procedure Initialise
                     statements .....
                 End Procedure
               Procedure Program Body
                     statements .....
                 End Procedure
               Procedure Terminate
                     statements .....
                 End Procedure
               etc.
               etc.
      End Program

Tony Drewry
 
Tony's Home Page
 
Back to TOP