0% found this document useful (0 votes)
28 views8 pages

POP Vs OOP

Uploaded by

patbate71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

POP Vs OOP

Uploaded by

patbate71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Object-Oriented Programming (OOP)

Object-oriented programming (OOP) is a programming paradigm that organises


software design around data, rather than functions and logic. It is a high-level
programming language that divides the program into chunks called objects. An object
is a data field with its own set of properties and behaviour.

Object-oriented programming (OOP) focuses on the objects that developers desire to


handle rather than the logic that is required to manipulate them. This kind of
programming is ideally suited to big, complicated, and frequently updated or
maintained projects. This encompasses manufacturing and design software, as well as
mobile applications; for example, OOP may be used to simulate manufacturing
systems.

Concepts of Object-Oriented Programming


There are 6 major concepts of OOP (Object-Oriented programming). The following are
the fundamental concepts that define it:

1. Class

A collection of objects is referred to as a class. Classes, unlike primitive data


structures, are user-defined data structures. They make the code easier to work with.

2. Objects

Objects are considered types of variables and are instances of classes. An object
creates a user-defined data type via a class. Only the object's description or blueprint is
created when we define a class. There will be no memory allocation until the object is
created. Real data or information is stored in the objector instance.

3. Inheritance

Inheritance refers to a class's capacity to derive features and traits from another class.
One of the most significant features of Object-Oriented Programming is
inheritance. Inheritance refers to an object that uses the methods and properties of
another object. It improves the reusability of code. There are two types of classes when
we implement inheritance:
 Sub Class or Child Class: A Sub Class or Derived Class is a class that inherits
properties from another class.

 Parent Class or Super Class: A Base Class or Super Class is a class whose
properties are inherited by subclasses.
4. Polymorphism

Polymorphism refers to an object's ability to do different activities (or exhibit distinct


behaviours) depending on the situation.

5. Abstraction

Abstraction is the process of hiding implementation details from the user, leaving only
the functionality available. Abstract classes and interfaces aim to achieve abstraction,
which in turn helps in creating reusable codes. In simple terms, the user will be given
knowledge about what the object does rather than how it does it.

6. Encapsulation

Encapsulation is a mechanism for combining data (variables) and code that acts on the
data (methods) into a single unit. Encapsulation means that a class's variables are
concealed from other classes and can only be accessed through its own methods.

Now that we've understood the key OOP concept, let's take a look at the advantages
and disadvantages of OOP (Object-Oriented Programming).

Advantages of OOP
 Rather than needing to start writing code from scratch, programs can be built
from standard functioning modules that communicate with one another, which
saves time and increases productivity. The OOP language allows us to divide
the program down into bite-sized problems that can be solved quickly (one
object at a time).
 The new technology promises higher programmer efficiency, improved software
quality, and lower maintenance costs.

 Small to large OOP systems can be simply upgraded.

 It is possible for numerous instances of objects to coexist without interfering with


one other, and it is very simple to divide work into a project based on objects.

 It is feasible to map problem domain objects to program objects.

 The data-hiding principle aids programmers in creating secure programs that are
not vulnerable to code in other areas of the program and can't be accessed by
external functions.

 Duplicate code can be minimized and increase the use of existing classes by
using inheritance.

 For communication between objects, message-passing mechanisms are utilised,


which simplifies the interface specifications with external systems.

 Data-centred designs can be used to get an implementable model in order to


capture more information.

Disadvantages of OOP
 The length of programs written in the OOP language is significantly greater than
that of programs written in the procedural technique. As the program grows in
size, it takes longer to execute, resulting in slower program execution.

 Since OOP is not a universal language, it cannot be used everywhere. It is only


used when absolutely necessary. It is not appropriate for all types of issues.

 Using OOP is a little challenging, programmers must have excellent design and
programming skills, as well as adequate planning.

 Learning OOPs takes time. For some people, the thinking process involved with
object-oriented programming is not natural.

 Everything in OOP is considered as an object, we must have strong thinking


skills before using it.
Procedure-Oriented Programming (POP)

Procedural Oriented Programming is a programming method that focuses on the


functions or procedures needed for computation rather than the data itself.

POP uses a sequence of instructions to break down the program into functions, and
each task is completed in order. The global data or variables are shared by these
functions, and data is exchanged between them. Essentially POP uses a step-by-step
approach.

C, Pascal, and FORTRAN are examples of procedural programming languages.

Characteristics Of POP (Procedure-


Oriented Programming)
Listed below are the key features of POP:

 It focuses on the algorithm.

 Larger programs are broken down into functions, which are smaller programs.
The functions are followed by a sequence of sequential computational steps.

 Global variables can be used to communicate across functions.


 Data can flow freely from one function to the next.

 Data can be changed by functions at any time and from any location. (Functions
are programs that change the shape of data.)

 It employs a top-down programming approach.

Advantages of POP Language


 The programming simplicity, as well as the ease of implementation of compilers
and interpreters, make procedural programming ideal for general-purpose
programming.

 A wide range of books and online course materials on tested algorithms are
available, making it easy to study as you go.

 Because the source code is portable, it can also be used to target a different
CPU.

 It is not necessary to replicate the code because it can be reused in different


portions of the program.

 The memory need is also reduced using the Procedural Programming approach.

 The program flow can be simply followed.

Disadvantages of POP Language


 When Procedural Programming is used, the computer code is more difficult to
write.

 As procedural code is frequently not reusable, it may be necessary to rebuild it if


it is required for usage in another application.

 A correlation with real-world objects is difficult. Since real-world objects have


their own data and behaviour, POP makes it difficult to model real-world
scenarios

 The procedure is prioritised over the data, which may cause problems in data-
sensitive situations.
 Since the data is visible to the entire program, it is not very secure.

Differences Between OOP and POP


Let's take a look at the key differences between object-oriented programming and
procedure-oriented programming:

Procedure Oriented
Parameter Object Oriented Programming(OOP)
Programming(POP)

OOP refers to Object Oriented POP refers to Procedural Oriented


Definition Programming. It deals with objects and Programming and deals with
their properties. programs and functions.

An object-oriented program uses the A procedure-oriented program uses


Approach
bottom-up approach. the top-down approach.

Access control is supported by the


means of access modifiers. The access
Access Control No access modifiers are supported.
specifiers such as public, private and
protected are used.

There is no data-hiding mechanism.


Data can be hidden using
Data Hiding Data is globally accessible, as there
encapsulation.
are no access specifiers.

Object functions are linked through Parameter passing is involved in


Entity Linkage
message passing. message passing.

Method overloading and method


POP does not support
Polymorphism overriding are used in OOP to achieve
polymorphism.
polymorphism.
There is no concept of inheritance in
Virtual Function OOP supports inheritance and virtual POP and neither does it support the
and Inheritance functions and virtual classes via it. use of virtual classes or virtual
functions.

No code reusability is provided by


Code Reuse OOP supports code reusability.
POP.

Operator Operator overloading is not allowed


It is allowed in OOP.
Overloading in POP.

You might also like