Structured programming languages: An introduction

If you are a programmer, you may know the structured programming languages like the C language.

Those programming languages separate the data and the processing in the programs:

In fact, the variables and the functions are declared sparingly: there is no relation between the variables and the functions that use them.

Those programming languages are based on the mutual call of sub routines (functions and procedures): each subroutine offers a service to the subroutine that uses it.

Structured programming languages Example:

The sub routine f(int n, int tab[]) searches the values which are less than n! in an array.

The subroutine g(int n) calculates n! given an integer n.

The subroutine f uses the service offered by the subroutine g in order to accomplish its task.

Generally, the programs written in a structured language are composed of an important number of code lines.

They are often composed of a huge number of files. This decreases the maintability of programs and makes them difficult to maintain.

Structured programming languages: The importance of the use of subroutines

In a structured programming language, the use of subroutines in a program is optional but it is recommended.

If we don’t use subroutines, we are forced to copy/paste the same code in many files in our program.

So, we will increase considerably the number of lines of our program. The will cause a maintainability problem.

If we suppose that we made an error in the duplicated code, we must remember all the files that are affected with the erroneous pasted code.

If we leave only one erroneous code without correcting it, this causes a bug in our code and we are stuck with our customer.

Post a Comment

Previous Post Next Post