In: Computer Science
Compare and contrast (1) the procedural/functional approach (defining a function for each operation with the function body providing a case for each data variant) and (2) the object-oriented approach (defining a class for each data variant with the class definition providing a method for each operation). (250 own words)
Difference between Procedural/ functional approach and the object oriented approach.
In procedural approach a function is defined for each operation with the function body providing a case for each data variant and in object oriented approach a class is defined for each data variant with the class definition providing a method for each operations.
The major differences are given below.
|
SI No. |
Approach |
Procedural Approach |
Object Oriented Approach |
|
1 |
Design |
Define a procedure or function for all operations and call them during evaluation. The concept used is structured programming |
The programs are designed using the concept of Objects, which contains data in the form of attributes and codes. |
|
2 |
Division |
Here the program is divided into functions |
Here the program are divided into objects |
|
3 |
Model |
Follows declarative programming model |
Follows imperative programming model |
|
4 |
Execution |
Follows a systematic step by step approach to execute methods and functions |
Various functions can call simultaneously |
|
5 |
Process |
The approach used in procedural oriented programming is Top Down Approach |
The approach used is Bottom Up Approach |
|
6 |
Linking |
Different part of the program are interconnected by parameter passing |
The functions of the objects are connected by message passing |
|
7 |
Data sharing |
Global data is shared among the functions |
Data is shared among the objects through the member function |
|
8 |
Importance |
Give more importance to function than data |
Give more importance to data than function |
|
9 |
Security |
Less secure, in the sense that there is no proper way for data hiding |
Highly secure, data hiding is there |
|
10 |
Overloading |
Both operator overloading and function overloading are not supported in procedure approach |
Overloads functions, operators and constructor |
|
11 |
Inheritance |
There is no provision of inheritance and hence there is no concept of access specifiers |
Inheritance is used with the concept of access specifiers like private, public and protected are used here |
|
12 |
Support |
Support parallel programming |
Does not support parallel programming |
|
13 |
Modification |
Adding a new function is not easy |
Adding a new object is easy |
|
14 |
Based on |
Based on unreal world |
Based on real world |
|
15 |
Example |
Eg. C, Fortan, Pascal, Basic |
Eg. C++, Java, Python |
From the table it is clear that Object oriented approach has a little edge over Procedural approach in the sense of data security, ease of use, accessibility etc.