Difference between Procedure
Oriented Programming and Object Oriented Programming | Procedure Oriented
Programming vs. Object Oriented Programming
POP
Conventional programming using high level languages such as
COBOL,FORTRAN and C, is commonly known as procedure oriented programming(POP). In the procedure oriented
approach, the problem is viewed as a sequence of things to be done such as
reading, calculating and printing. A number of functions are written to
accomplish these tasks. The primary focus is on functions.
Procedure oriented
programming basically consists of writing a list of instructions (or actions)
for the computer to follow, and organizing these instructions into groups known
as functions.
In a multi-function
program, many important data items are placed as global so that they may be
accessed by all functions. Each function may have its own local data. Global
data are more vulnerable to an inadvertent change by a function. In a large
program it is very difficult to identify what data is used by which function.
In case we need to revise an external data structure, we also need to revise
all functions that access the data. This provides an opportunity for bugs to
creep in.
Another serious
drawback with the procedural approach is that it does not model real world
problems very well. This is because functions are action-oriented and do not
really correspond to the elements of the problem.
Some characteristics of Procedure Oriented Programming are :-
1) Emphasis is on doing things(algorithms).
2) Large programs are divided into smaller programs known as functions.
3) Most of the functions share global data.
4) Data more openly around the system from function to function.
5) Functions transform data from one form to another.
6) Employs top-down approach in program design.
1) Emphasis is on doing things(algorithms).
2) Large programs are divided into smaller programs known as functions.
3) Most of the functions share global data.
4) Data more openly around the system from function to function.
5) Functions transform data from one form to another.
6) Employs top-down approach in program design.
OOP
The major motivating factor in the invention of object oriented is to
remove some of the flaws encountered in the procedural oriented approach.
Object oriented programming treats data as a critical element in the program
development and does not allow it to flow freely around the system. It ties
data more closely to the functions that operate on it, and protects it from
accidental modifications from outside functions.
Object oriented
programming allows a decomposition of a problem into a number entities called
objects and then builds data and functions around these objects. The data of an
object can be accessed only by the functions associated with that object.
However, functions of one object can access the functions of other objects.
Some characteristics of Object Oriented Programming are :-
1) Emphasis is on data rather than procedures or algorithms.
2) Programs are divided into what are known as objects.
3) Data structures are designed such that characterize the objects.
4) Functions that operate on the data are tied together in the data structure.
5) Data is hidden and cannot be accessed by external functions.
6) Objects may communicate with each other through functions.
7) New data and functions can be easily added whenever necessary.
8) Follows bottom-up approach in program design.
1) Emphasis is on data rather than procedures or algorithms.
2) Programs are divided into what are known as objects.
3) Data structures are designed such that characterize the objects.
4) Functions that operate on the data are tied together in the data structure.
5) Data is hidden and cannot be accessed by external functions.
6) Objects may communicate with each other through functions.
7) New data and functions can be easily added whenever necessary.
8) Follows bottom-up approach in program design.
Benefits of Object Oriented Programming over
Procedure Oriented Programming :-
1) Through inheritance, we can eliminate redundant code and extend the use of existing classes which is not possible in procedure oriented approach.
2) We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch which happens procedure oriented approach. This leads to saving of development time and higher productivity.
3) The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
4) It is possible to have multiple instances of object to co-exist without any interference.
5) It is possible to map objects in the problem domain to those in the program.
6) It is easy to partition the work in a project based on objects .
6) The data-centered design approach enables us to capture more details of a model in implementable from.
7) Object oriented systems can be easily upgraded from small to large systems.
8) Message passing techniques for communication between objects makes the interface descriptions with external systems much simpler.
9) Software complexity can be easily managed.
1) Through inheritance, we can eliminate redundant code and extend the use of existing classes which is not possible in procedure oriented approach.
2) We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch which happens procedure oriented approach. This leads to saving of development time and higher productivity.
3) The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
4) It is possible to have multiple instances of object to co-exist without any interference.
5) It is possible to map objects in the problem domain to those in the program.
6) It is easy to partition the work in a project based on objects .
6) The data-centered design approach enables us to capture more details of a model in implementable from.
7) Object oriented systems can be easily upgraded from small to large systems.
8) Message passing techniques for communication between objects makes the interface descriptions with external systems much simpler.
9) Software complexity can be easily managed.
Difference Between
Procedure Oriented Programming (POP) & Object Oriented Programming (OOP)
Procedure Oriented Programming
|
Object
Oriented Programming
|
|
Divided Into
|
In POP, program is divided into small parts
called functions.
|
In OOP, program is divided into parts
called objects.
|
Importance
|
In POP, Importance is not given to data
but to functions as well as sequence of actions to be done.
|
In OOP, Importance is given to the data
rather than procedures or functions because it works as a real
world.
|
Approach
|
POP follows Top Down approach.
|
OOP follows Bottom Up approach.
|
Access Specifiers
|
POP does not have any access specifier.
|
OOP has access specifiers named Public,
Private, Protected, etc.
|
Data Moving
|
In POP, Data can move freely from function
to function in the system.
|
In OOP, objects can move and communicate
with each other through member functions.
|
Expansion
|
To add new data and function in POP is not
so easy.
|
OOP provides an easy way to add new data
and function.
|
Data Access
|
In POP, Most function uses Global data for
sharing that can be accessed freely from function to function in the system.
|
In OOP, data can not move easily from
function to function, it can be kept public or private so we can control the
access of data.
|
Data Hiding
|
POP does not have any proper way for hiding
data so it is less secure.
|
OOP provides Data Hiding so provides more
security.
|
Overloading
|
In POP, Overloading is not possible.
|
In OOP, overloading is possible in the form
of Function Overloading and Operator Overloading.
|
Examples
|
Example of POP are : C, VB, FORTRAN,
Pascal.
|
Example of OOP are : C++, JAVA, VB.NET,
C#.NET.
|
No comments:
Post a Comment