Unstructured programming-> procedural programming-> modular programming-> object-oriented programming.
Usually, people start learning programming by writing small and simple programs consisting only of one main program. Here, main program stands for a sequence of commands or statements which modify data which is global throughout the whole program.
In unstructured programming, the main program directly operates on global data.
The programming technique provides tremendous disadvantages once the program gets sufficiently large. For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied. This has led to the idea to extract sequence, name them and offer a technique to call and return from these procedures.
With procedural programming you are able to combine returning sequences of statement into one single place. A procedure call is used to invoke the procedure. after the sequence is processed, flow of control proceeds right after the position where the call was made.execution of procedures, after processing flow of controls proceed where the call was made.
With parameter as well as procedures, programs can now be written in more structured and error free manner. For example, if a procedure is correct, every time it produces correct results. Consequently, in cases of errors you can focus your search to those places , which are causing errors.
Now, a program can be viewed as sequence of procedures calls . The main program is responsible to pass data to the individual calls, the data is processed by the procedures and, once the procedures has finished, the resulting data is presented.
The main program coordinates calls procedures and hands over appropriate data as parameters.
Now, we have a single program which is divided into small pieces called procedures. To enable usage of general procedures or groups of procedures also in other programs, they must be separately available. For that reason , modular programming allows grouping of procedures into modules.
With modular programming, statements of a common functionality are grouped together into separate modules. A program, there for , no longer consists of only one single part. It is now divided into several smaller part, which interact through procedural calls and which from the whole program.
In modular programming, the main program coordinates calls to procedurals in separate modules and hands over appropriate data as parameters. s in separate modules
Each module can have its own data. This allows each module to manage an internal state, which is modified by calls procedures of this module. However, there is only one state per module and each module exists at most once in the whole program.
Object-oriented programming(OOP) is an approach to program organization and development that attempts to eliminate some of the pitfalls of conventional programming methods by incorporating the best of the structured programming features with several powerful new concepts. The major motivating factor in the invention of object-oriented approach is to salvage some of the flaws encountered in the procedurals approach.
Object-oriented programming can be defined as:
“object-oriented programming is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.”
INTRO TO C++
The fundamental idea behind object-oriented languages is to combine both data and the function into ...read more
EVOLUTION OF C++
During the late 1970s and early 1980s, C became the dominant computer programming language, and ...read more