Structured programming has been called a revolution in programming - a systematic way to organize programs.
Structured
programming can be defined as a
- top–down analysis for
program solving
- modularization for
program structure and organization
- structured code for
individual modules
The
four basic steps to top-down analysis
are as follows:
1. Define the complete scope of the problem to
determine the basic requirement for its solution.
2.
Based on the definition of the problem, divide the problem into two or more
separate parts.
3.
Carefully define the scope of each of these separate tasks and subdivide them
further, if necessary, into two or more smaller tasks.
4.
Repeat step 3. Every step at the lowest level describes a simple task, which
cannot be broken further.
Modular programming is a program that is divided into logically
independent smaller sections, which can be written separately. These sections,
being separate and independent units, are called modules.
After
the top-down analysis and design of the modular structure, the third and final
phase of structured programming involves the use of structured code. Structured
programming is a method of coding, i.e., writing a program that produces a
well-organised module.
The
structured program mainly consists of three types of elements:
- Selection
Statements
- Sequence
Statements
- Iteration
Statements
The
structured program consists of well structured and separated modules. The
program uses single-entry and single-exit elements.
The
purpose of structured programming is to make control flow linear through a
computer program so that the execution sequence follows the sequence in which
the code is written.
This
enhances the readability, testability, and modifiability of the program.
Types of structured programming
Structured
programming can be divided into three categories, including:
1.
Procedural
programming.
Defines
modules as "procedures" or "functions" that are called with
a set of parameters to perform a task.
2.
Object-oriented
programming (OOP).
Defines a program as a set of objects or
resources to which commands are sent. An object-oriented language will define a
data resource and send it to process commands.
3.
Model-based
programming.
The most common example of this is database query languages. In database programming, units of code are associated with steps in database access and update or run when those steps occur. The database and database access structure will determine the structure of the code.
The primary advantages of structured programming
are:
- It encourages
top-down implementation, which improves both readability and
maintainability of code.
- It promotes code
reuse, since even internal modules can be extracted and made independent,
residents in libraries, described in directories and referenced by many
other applications.
- It's widely agreed
that development time and code quality are improved through structured
programming.
No comments:
Post a Comment