Chapter 4 An Introduction To Programming Structure
Chapter 4 An Introduction To Programming Structure
Chapter 4 An Introduction To Programming Structure
Pointers for
Structuring a
Program
1. Use Modules
2. Use the four logic structures
a. Sequential Structure
b. Decision Structure
c. Loop Structure
d. Case Structure
Cohesion and
Coupling
Cohesion
@ relates to the functional independence of the
module and to the performance of a single “task”
within the module
Coupling
@ allows modules to be connected by an interface,
which enables the programmer to transfer data
from one module to another.
Modules
Modules
Types of Modules
1. Control Module
2. Initialization Module
3. Process Data Module
a. Calculation Modules
b. Print Modules
c. Read and Data Validation Modules
4. Wrap-up module
5. Event Modules (OO-Paradigm)
Global Variables
@ they are global to the program as they can be seen by
all modules
Parameters
Parameters
@ local variables that are passed or sent from one
module to another. Parameters are another way
of facilitating coupling that allows the
communication of data between modules
Calling Module
@ the module that processes another module
Called Module
@ the module being processed
Parameters
Parameters
Parameters
Parameters
Variable Names
and Data
Dictionary