Topic: Modularization
- isolation of the modulo code into a subroutine
February 11,
2016
Modularization is another basic element of programming.
Modularization is breaking the program into small modules of code, about one page or screen full in size,
Modularization is solely for the convenience of humans.
It doesn't affect the computer and actually slows the program slightly.
The modules are classified by various names based on some subtle but important differences,
but they achieve some common purposes. (see Advantages below)
The names used are "subroutines", "functions", "procedures", and "classes".
The modules are "called" from within the main program, transferring the sequential execution to the module's code.
At the end of the module's code, execution transfers back to the main program at the place where it was called.
Modules can also be called from other modules, working the same way.
Each module should do a well defined subtask in the program.
Advantages of modularization:
Isolates the code into chunks that are more easily understood by humans.
Makes code more easily debugged.
Makes code more easily re-usable.
Allows easy substitution of improved code.
Isolates variables and reduces the chance that they can given improper values.