Wednesday, August 10, 2016

Object-Oriented Programming vs Procedural Programming

Procedural programming
  • uses a list of instructions to tell the computer what to do step-by-step
  • relies on - you guessed it - procedures, also known as routines or subroutines.
  • Top-down languages.
  • Intuitive in the sense that it is similar to how you would expect a program to work. If you want a computer to do something, you should provide step-by-step instructions on how to do it. 
  • Most of the early programming languages are all procedural. Examples of procedural languages include Fortran, COBOL and C, around since the 1960s and 70s.
Object-Oriented Programming
  • is an approach to problem-solving where all computations are carried out using objects
  • An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. 
  • A simple example of an object would be a person. name is a property of the person. Walking i s a method of the person.
  • Examples of object-oriented languages include C#, Java, Perl and Python.

POP
OOP
Divided Into
program is divided into small parts called functions.
program is divided into parts called objects.
Importance
Importance is not given to data but to functions as well as sequence of actions to be done.
Importance is given to the data rather than procedures or functions because it works as a real world.
Approach
Top Down approach.
Bottom Up approach.
Access Specifiers
does not have any access specifier.
has access specifiers named Public, Private, Protected, etc.
Data Moving
Data can move freely from function to function in the system.
 objects can move and communicate with each other through member functions.
Expansion
To add new data and function is not so easy.
provides an easy way to add new data and function.
Data Access
 function uses Global data for sharing that can be accessed freely from function to function in the system.
data cannot move easily from function to function, it can be kept public or private so we can control the access of data.
Data Hiding
does not have any proper way for hiding data so it is less secure.
provides Data Hiding so provides more security.
Overloading
Overloading is not possible.
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