C++ – Procedural Programming Paradigm

Procedural Programming Paradigm:

The first question is why to learn C ++? The answer is equally simple. It is the most powerful programming language to date. Programmers have to build large and complex programs, then Professional Programmers choose C ++. There are many more simple and effective languages, but because of their shortcomings, there is a limit to program development.

Just like Visual Basic is a very simple language of Microsoft Company, but when programs are very large and complex, then it is not wise to develop programs in this language. Because Graphics is used a lot in this language, there are many other reasons, due to which large programs are developed in this language, the speed of the program is greatly reduced.

Procedural Programming Paradigm

Assembly language is also very good. The speed of the programs written in it is very good, but this language is better for writing the programs of Hardware Device Drivers and not for writing application programs.

Similarly Java is good for Internet, although Java is inspired by C ++. But C ++ is the most popular language for a large Standalone Application Development. It is a very flexible and best performing language.

Procedural Languages

Traditional languages ​​like Pascal, C, Basic, Fortran are examples of Procedural Languages. In which each statement commands the Computer to do some work. That is, a set of Procedural Languages ​​Instructions.

In Procedural Languages, small programs do not require any other type of pattern. Programmer creates a list of Instructions and Computer works according to them.
When programs become very large and complex, then this list of Instructions causes a lot of trouble. Therefore a large program is divided into small pieces. These small pieces are called Functions . Functions are called Subroutine, Subprogram or Procedure in other languages .

Splitting a large program into smaller functions creates a group of complete program functions, called Module . But these Modules also come under Procedural Programming because all Functions have a List of Statements and all Functions together form a complete program, which makes the entire Program a very large list of Instructions. In the early stages of Procedural Languages, programs were developed in these only.

“C” is also a Procedural Languages and when the “C” language was invented, then the programmers started developing their programs in “C”, leaving other languages. But when the programs started getting bigger and more complex as per the time and requirement, then the programmers started having problems in making programs in this language. He felt that this language needs some improvement so that it can become simple and popular.

To make this language 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 the program with more ease and success in it. Language according to real life, this Concept Object Oriented Programming , or OOPS the grounds.

These various types of deficiencies in the “C” language were identified and rectified. As a result, we got a new version of C language called C ++. Let us also try to know what were the shortcomings in the “C” language, in which the need for improvement was felt?

That is to input data from the keyboard, processing data, checking errors etc. The same importance continued in functions. Functions do any work in the same way a simple statement does. Functions can also do any complex work, but they also had the importance of being useful. Data was not given any attention in the entire program, whereas the basic basis of the entire program is Data .

In an Inventory program, there is not much importance on how data is displayed or how a function checks Corrupt Data, rather it is about what data is and what it is. The program is being used as follows. In the procedural program, the data was kept at the secondary level whereas the basic basis of any program is the data itself.

For example, a data file is loaded into memory in an Inventory program, then this file is like a Global Variable, which any function can use. These functions perform various types of operations on the data. This means:

  • Let us read the data,
  • Let’s analyze
  • Update,
  • Rearrange do,
  • Display and
  • Let’s write back to the disk.

“C” also contains Local Variables but Local Variables are not so useful for important data, which are accessed by various functions.
Suppose a new programmer was asked to write a function to analyze the data in a particular way. Unaware of the complexity of the program, the programmer creates a function that suddenly destroys some important data. This is quite easy to happen because any function can access the data, because in the procedural language, data is global. This is similar to placing your personal papers with the Telephone Directory, where anyone can reach, scavenge and destroy them. Similarly in Procedural Languages ​​where your data is global and any function can spoil or damage it by using it.

Another drawback of Procedural Languages ​​was that many functions are using the same data simultaneously, so the way of storing data becomes quite complicated. No modification of any type of data can be made without modifying all functions using the same data.

For example, if you add a new data, then you have to modify all the functions that are using the data so that all these functions can use the new data added. It is very difficult to find out which function data you are using and to modify it all in the right way.

Designing procedural programs is quite difficult. The problem is that their design is not related to real life. For example, suppose you want to write the code for Menus Window in a Graphics User Interface, then you will have to decide which function to use? Which data structure should be used? e.t.c. There is no clear answer to them.

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. Suppose you want to process with Complex Numbers or work with Two-Dimensional Coordinates or with Date. Built-in Data Type cannot be easily handled by them. So we need to create our own Data Type as per our requirement.

That is, to represent the Real World Objects, we need a way to easily represent the Real World Objects in the computer and in the way a proper solution to a problem by interacting different objects in the Real World. In the same way, the solution of any problem in the computer can also be obtained.

By creating our own Data Types in Procedural Language, we cannot use them exactly like the Built-in Data Type. Procedural languages ​​are not so advanced. Without adopting complex methods, we cannot process and store both x and y coordinates in the same variable in Procedural Languages. Also writing and maintaining procedural languages ​​is quite a difficult task.

Summary

  • The importance of performing tasks in procedural language was not of data. That is to divide the Primary Attention Problem into Functions and not Security of Data. (Algorithm)
  • Large programs were divided into smaller programs, called Functions.
  • Most functions shared global data, making data insecure.
  • In the application, data was easily transacted between different functions.
  • Various functions used to transform data into different forms.
  • Used to support the top-down Approach.