Structured Programming and Procedural Programming

We have been learning, accessing, and applying methods available in Python (it would be impossible to teach Python without doing so). Although the syntax and use of these methods are inherently object-oriented, we have been using them in the context of procedural program design and in the form of structured programs. Recall that procedural programs use functions as a way of breaking a program down into a set of procedures to solve a problem. Read this page to learn why we have been arranging our programs the way we have.

Structured Programming

In the process of coding, the lines of code keep multiplying, thus, the size of the software increases. Gradually, it becomes next to impossible to remember the flow of the program. If one forgets how software and its underlying programs, files, and procedures are constructed, it then becomes very difficult to share, debug, and modify the program. The solution to this is structured programming. It encourages the developer to use subroutines and loops instead of using simple jumps in the code, thereby bringing clarity in the code and improving its efficiency structured programming also helps the programmer to reduce coding time and organize code properly.

Structured programming states how the program shall be coded. Structured programming uses three main concepts:

Top-down analysis - A software is always made to perform some rational work. This rational work is known as a problem in software parlance. Thus, it is very important that we understand how to solve the problem. Under top-down analysis, the problem is broken down into small pieces where each one has some significance. Each problem is individually solved and steps are clearly stated about how to solve the problem.

Modular Programming - While programming, the code is broken down into a smaller group of instructions. These groups are known as modules, subprograms, or subroutines. Modular programming based on the understanding of top-down analysis. It discourages jumps using 'goto' statements in the program, which often makes the program flow non-traceable. Jumps are prohibited and modular format is encouraged in structured programming.

Structured Coding - In reference to top-down analysis, structured coding sub-divides the modules into further smaller units of code in the order of their execution. Structured programming uses control structure, which controls the flow of the program, whereas structured coding uses control structure to organize its instructions in definable patterns.

Source: eVidhya,
Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 License.