Procedural programming language Example: Traditional languages like Pascal, C, Basic, Fortran are examples of Procedural Languages, in which each statement commands the computer to do something.
in procedural programming language, That is, a Procedural Language Program is a set of instructions. Small programs in Procedural Languages do not require any other type of pattern. The programmer makes a list of instructions and the computer works according to them.
Procedural Programming Paradigm Example
When programs become very large and complex, then this instruction list of instructions creates a lot of trouble.
That’s why a big program is broken down into smaller pieces. These small pieces are called functions. Functions are called Subroutine, Sub-Program or Procedure in other languages.
By dividing a large program into smaller functions, the whole program becomes a group of functions.
This is called a module. But these modules also come in Procedural Programming because all the functions have a list of statements and all the functions together make up the complete program, so that the whole program becomes a very big list of instructions.
In the early stages of Procedural Languages, programs were developed in these. “C” is also a Procedural Languages and when the “C” language was invented, the programmers started developing their programs in “C” leaving other languages.
But according to the time and requirement, when the programs started getting big and complex, then the programmers started facing problems in making programs in this language.
He felt that some improvement was needed in this language so that this language could become simple and popular. For this language to be simple, it was necessary to be according to real life.
That is, the way we behave in our normal life, it was necessary to have the same language so that the programmers can make programs in it more easily and successfully. The language should be according to real life, this concept became the basis of Object Oriented Programming i.e. OOP.
These deficiencies in the “C” language were recognized and rectified. As a result we got a new version of “C” language “C++” which is based on Object Oriented Concept.
According to the need, the shortcomings of this language were also recognized and the new language that emerged after improving it was Java. Come, let us also try to know what were the shortcomings in the “C” language, in which the need for improvement was felt?
The importance of working in Procedural Languages was not of data, that is, inputting data from the keyboard, processing data, checking errors, etc.
The same importance was continued in functions as well. Functions do any work, in the same way as a simple statement does.
Functions can also do any complex work, but it was important to have work in these too.
In the entire program, no attention was paid to the data, whereas the basic basis of the entire program is the data itself.
That is, in the program of an inventory, it is not of much importance that how the data is displayed or how a function checks the corrupt data, but what is the data and what is it.
How is the program working? – procedural programming language
In the Procedural Program, the data was kept at the second level, whereas the basic basis of any program is the data itself.
In the program of an inventory, a data file is loaded into memory, then this file is like a global variable, which can be used by any function. These functions perform various types of operations on the data.
That is, they read the data, analyze, update, rearrange, display and write back to disk. “C” also has local variables but local variables are not so useful for important data, which are accessed by different functions.
Suppose a new programmer was asked to write a function to analyze the data in a particular way.
A programmer ignorant of the complexity of the program creates a function that suddenly destroys some important data. It is quite easy to do so because any function can access the data.
Because data is global in Procedural Language. It is like keeping your personal documents near the telephone directory where anyone can access, tamper with and destroy it at any time.
Similarly, it happens in Procedural Languages where your data is global and any function can spoil or damage it by using it.
The second drawback of Procedural Languages was that many functions are simultaneously using the same data, so the way of storing the data becomes quite complicated. No changes can be made to the data without modifying all the functions using the same data.
For example, if you add a new data, then all the functions that are using the data will have to be modified, so that all these functions can use the new data added. It is very difficult to find out which functions are using the data and modify them all correctly.
Designing Procedural Programs is very difficult. The problem is that their design is not related to real life.
For example, suppose you want to write code for Menus, Windows in a Graphics User Interface, then you will find it difficult to decide which functions to use? Which Data Structure should be used? e.t.c. There is no clear answer to these questions.
There are many other problems with Procedural Programs. One of them is the problem of the new data type. There are many types of built-in data types in computer languages, such as Integer, Float, Character etc.
procedural programming language – Let’s say you want to process with complex numbers or with two-dimensional coordinates or with dates. Built-in Data Type cannot handle them easily. So we need to create our own Data Type as per our requirement.
By creating our own Data Type in Procedural Language, we cannot use them exactly like Built-in Data Type.
Procedural languages are not that advanced. Without unnaturally complex methods, you cannot store both x and y coordinates in the same variable in Procedural Languages and process them. Writing and maintaining Procedural Languages is a very difficult task. (Procedural Programming Paradigm Example)