Programming 2 Module 2
Programming 2 Module 2
STRUCTURED PROGRAMMING
Outline:
- Top-Down Analysis
- Modular Programming
- Structure Code
1. Top-Down Analysis
As programs are written to provide a solution to any type of problem. For larger
problems, developing a programmatic solution can be complicated we might think where
to start from, how to precede where to terminate.
The ideas followed are subdivision of program which means that the entire
problem is broken down into smaller parts so that it can be analyzed and an appropriate
solution can be devised.
For it hierarchy of task means that subdivided parts of the major problem are
further broken into task thus creating a hierarchy.
Advantage of top-down analysis is reduces the complexity of problem solving not limited
by a particular type of program.
1
Page
STEPS for top-down analysis:
Step One : is to define the complete scope of problem to be solved, it includes the
determination of
Step Three : is defining the scope of each subdivided parts and dividing them further into
tasks.
Step Four : repeat step three till a simple task is reached which cannot be further
subdivided.
2. Modular Programming
A module has entry point to which the control is transferred from outside the
module. There is only one exit point from which the control is returned back to the
calling functions.
Modular programming is a solution to the problem of very large programs that are
difficult to debug and maintain.
2
Page
Many old programming languages which use goto statements have unstructured
code, as the control of the program is altered unconditionally. Goto can be replaced by if
if-else else if ladder to write the code in a structured manner which is termed as
structured coding.
3
Page