POP Vs OOP
POP Vs OOP
1. Class
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
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.
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.
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.
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.
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.
Larger programs are broken down into functions, which are smaller programs.
The functions are followed by a sequence of sequential computational steps.
Data can be changed by functions at any time and from any location. (Functions
are programs that change the shape of data.)
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.
The memory need is also reduced using the Procedural Programming approach.
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.
Procedure Oriented
Parameter Object Oriented Programming(OOP)
Programming(POP)