Table of Contents
In structured programming design, programs are broken into functions (also known as modules, subprograms, subroutines, or procedures). Each function is designed to do a specific task with its own data and logic. Information can be passed from one function to another function through parameters. A function can have local data that cannot be accessed outside the function’s scope. The results from different functions are synthesized in another function (main function). Many high-level languages support structured programming.
Structured programming minimized the chances of one function affecting another. It supported writing clearer programs. It made global variables disappear and be replaced by local variables and parameters. Its organization helped to understand the programming logic easily. It also made debugging easier.
Functional abstraction was introduced with structured programming. Abstraction means the ability to look at something without bothering about its internal details. In a structured program, it is sufficient to know that a given function performs a specific task. How that task is performed is not important.
Advantages of Structured Programming:
Following are the advantages of structured programming:
- Decreases the complexity of the program by breaking it down into smaller logical units.
- Allows several programmers to perform coding simultaneously.
- Allows common functions to be written once and then used in all the programs needing it.
- Decreases debugging time, because modules make it easier to isolate errors.
- Amendments to single modules do not affect the rest of the program.
- It saves time to use modular structures rather than using self-made structures. If a job can be done well by using what is already available and known to be well tried and tested then trying out something new for sake of it, is a waste of effort.
- Standard method, so, less time is required in writing programs.
- It is easier to name modules in such a way that they are easy to find in the documentation and consistent.
Disadvantages of Structured Programming:
- Structured programs generally have redundant codes and are lengthy as compared to unstructured programs.
- Structured programs often use more memory and may execute slower.
- Limiting the structures to three or four basic forms, makes some tasks rather ‘messy’ to perform.
- The completeness of basic logic structures only means that all programs can be implemented with them; it does not mean that a given program can be implemented efficiently or will be bug-free.