What is Structured Programming?
- Structured programming is a logical programming method that is considered a precursor to object-oriented programming (OOP). Structured programming facilitates program understanding and modification and has a top-down design approach, where a system is divided into compositional subsystems.
- Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or set of similar functions is coded in a separate module or submodule, which means that code can be loaded into memory more efficiently and that modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure.
- In one view it avoids using the dangerous goto statement. This prevents potentially confusing transfers of control. Many structured programming languages support the goto statement, which can be used in a structured manner. For example, to exit to the end of a routine, or return to the beginning of a loop.
- In another view, structured programming confines itself to using control structures with only one entry point and one exit point. The most important of these structures are sequence, selection (if and if..else) and repetition (while).
- Yet another view is that structured programs are programs written in such a way that they can be understood easily using abstraction. Abstraction means being able to understand the overall purpose of some code without understanding the detail. A prime mechanism for abstraction is the procedure (method). But the above-mentioned single-entry single-exit structures also help in using abstraction.
- Structured programming was made possible by high-level languages and packages of related programs, that could be flow charted with software diagramming techniques understandable to non-programmers.