SlideShare a Scribd company logo
2
Most read
What is OOP?
(Object Oriented
Programming)
BY: HREEM P.
Fundamentals and Outline of OOP
In simplest terms, OOP (Object Oriented Programming) can be defined as a programming model that
organizes software design around objects and classes rather then functions and logic as is used in
language such as Python. One of the biggest and most popular OOP languages is Java.There are many
fundamental concepts that make up OOP and these concepts are adapted by most OOP languages in
order to maximize the potential of the language they are as follows:
▸ Encapsulation
▸ Modularity
▸ Polymorphism
▸ Inheritance
These concepts will be explained with detail in the following slides along with other key
concepts/questions about OOP
2
Encapsulation
Encapsulation in OOP is a way for the program to not have access or restrict certain components of an
object so that the user cannot access variables of a particular object. Encapsulation can hide data
methods/functions/members associated with an object. It allows for the bundling of data (variables)
along with methods that act on it into a single unit to be used
Why is Encapsulation useful?
There are a few key benefits of encapsulation as follows:
Allows for hidden data: It allows for privacy of a user’s program as other users will not know how the
classes is being stored or implemented but only the values that are being passed or initialized
More flexible and efficient: It allows for variable names to be write-only so that you can omit accessor
methods such as getYear()
Easily reused: It allows the user to easily change and adapt to new input requirements
3
A pictogram
illustrating the
use of
encapsulation
Write-Only Variables: A variable in which a
value can be assigned but cannot be
accessed as there is no accessor for that
variable
Modularity
Another fundamental of OOP is modularity. Modularity can be defined as a technique of
programming in which a program’s functionality is split into independent and
interchangeable modules, so that each module contains all the logic necessary to
execute one part of the desired output of the program. Modules can be thought of as
pieces of a puzzle, and once all put together, a finished image is revealed
What are the benefits of Modularity?
Program is easier to read: It allows for another user to read your program easily and
efficiently as potentially larger program is split up into smaller modules/files each with
its own purpose. This also allows for your files to be smaller taking up less space on your
hard disk
Program is easier to test/debug: When splitting the program into smaller files,
testing/debugging of the code is easier as tests/debugging can be more detailed for
smaller programs/files which allows for the bug to be solved faster, or the test to be run
smoother
Easily find code/More organized: In modules, similar code is grouped together in order to
maximize the functionality of the module. This firstly, allows chunks of coed to be found
more easily as you know which module does a specific functionality and secondly allows
for more organized coding environment leading to less bugs in your code. 4
Polymorphism
Polymorphism is one of the bigger fundamental concepts of OOP. It can be defined as the
ability of a variable, function, object etc. in a program to take on multiple forms. An example
is it allows different objects in a program to behave as if they were the same. There are two
types of polymorphism that are common and are as follows
What are the types of Polymorphism?
Compile time Polymorphism: In this polymorphism, the type of an object is known at the
compile time which allowed for the compiler to use an appropriate implementation usually
through a technique known as method overloading
Runtime Polymorphism: In this polymorphism, the implementation of a function or method is
determined at runtime based on the actual type of the object. This is usually achieved through
inheritance
What are the benefits of Polymorphism?
Versatility of variables: It allows for a single variable name to store variables of multiple data
types
Allows for code to be reused/repurposed: It allows for the reuse of existing code by allowing
objects of different classes to be treated as if they are of the same class. 5
Method Overloading:
When multiple
methods can have the
same name with
different variables
Inheritance:
When a class is
derived/elements are
gotten from another
class
Inheritance
Inheritance can be defined as when a class derives methods, functions from another class.
The class that “inherits” these functionality is known as a child class and the class from which
it drives it from is known as the parent class. A child class can inherit methods from a parent
class while still having its own unique methods
What are the benefits of Inheritance?
Code reuse: An obvious benefit based on the definition is the fact that code can be reused as
when a child class inherits something from a parent class, it does not need to be rewritten.
Efficient coding: While inheriting, you can override/adjust methods of the parent class and
adapt them to the child class allowing for versatility in your coding (maintaining the useful
elements of a parent class while ignoring the extra elements)
How are Inheritance and Polymorphism related?
Inheritance and polymorphism work hand in hand as during run-time polymorphism, a child
class can be treated as objects of its parent class. This allows the child class to derive
functionalities of its parent class which allows the type of the child and parent class to be
determined at runtime (a feature of runtime polymorphism)
6
A pictogram
illustrating the
implementation
of inheritance
What is the Difference between Private, Public and Protected Members,
Accessors and Modifiers?
Private, public or protected members, accessors and modifiers while they
have different functionalities the accessibility of them remain depending on
whether they are private, public or protected. Hence defining these terms in
correlation to what they mean with members will explain the difference
between them
Members: Members are also known as instance variables and are declared in a class
with a type and are used later in methods, constructors etc.
Private: Private members can only be accessed within the class in which they are
declared. They cannot be accessed by any other class or object. They are usually
used ONLY in the class they are needed hence why they are private (because no
other class needs access to them). You must declare a member to be private using
the private keyword before the variable type
Public: Public members are accessible from anywhere in the program, including from
outside the class.
Protected: Protected members are similar to private members, but can also be
accessed by child classes. They are typically used for variables that are needed in
7
Class Hierarchy:
A series of parent
and child classes
all interconnected
Accessors: Accessors are used to obtain and modify the values of
members (instance variables). However, they are only limited to
accessing private and protected members. Accessors allow a level of
encapsulation as it limits/controls a class to how much code can be
modified by external classes/factors
Modifiers: Modifiers are keywords used to describe a class and specify
properties characteristics of them. Some of these keywords include:
- Static
- Virtual
- Final
- Abstract
8
What is the Difference between Private, Public and Protected Members,
Accessors and Modifiers?
An Outline of the Paradigm Shift that Occurred in the Move from Procedural
Programming to OOP
The paradigm shift that occurs when we moved from procedural programming
to OOP is significant in that both ways of programming are unique from one
another however, they can both be used in the same language.
Procedural programming was focused on writing procedures and functions
that manipulated data. It is a more structured way of programming that
involves creating a step-by-step procedure that executes a series of
instructions
OOP is focused on creating objects that encapsulate both data and behavior. It
allows for a more dynamic program that is versatile and can take a variety of
inputs. It creates a blueprint that makes it easier for more specific program
endeavours
This paradigm shift allowed for code to be reusable and allowed flexibility the
program. It also helped to modify and write previous programs that would
otherwise take way too long or too many lines to code. It also helped maintain
the code and allowed it be more versatile. 9
Paradigm:
Different ways or style
a program can be
organized (procedural
and OOP)
The Advantages of OOP over Earlier Paradigms
10
There are many advantages to OOP as opposed to other paradigms. Some of them are as follows:
Code Organization: OOP enables the programmer to use objects and classes to organize their code. This allows for code to be
broken into section each with its own purpose. This also indirectly organizes the code to be more readable for other users
Modularity: Bootlegging off of the previous advantage, the organization of code in OOP often comes through making different
modules and files for chunks of code that are similar. By doing this it is easier to develop, debug and test certain parts of the
code as you can run more specific tests, or find a certain module in which the bug is occurring, leaving you with less code to
debug.
Code Reusability: OOP emphasizes and allows code to be reused through inheritance and polymorphism (as stated before).
This reduces code duplication and promotes code reuse, leading to and efficient development of code
Modelling after the real life concepts and the world: OOP allows real life concepts such as maintaining a bank account to be
modelled in code through its use of objects and classes. This allows for real life programming issues to be tackled more easily
as there is a way to organize and structure code with OOP.
All in all, with all of the advantages OOP presents, there is no doubt as to why many software developers choose to use this
paradigm. OOP is mainly used for large scale projects that require a lot more time and debugging if other paradigms were
used. With that being said, other paradigms also have their benefits that OOP does not and OOP and other paradigms should
both be considered when one is programming
Citations
11
Gillis, A. S., & Lewis, S. (2021, July 13). What is object-oriented programming (OOP)? App Architecture. Retrieved
March 31, 2023, from https://www.techtarget.com/searchapparchitecture/definition/object-oriented-
programming-OOP
Encapsulation - definition & overview. Sumo Logic. (n.d.). Retrieved March 31, 2023, from
https://www.sumologic.com/glossary/encapsulation/#:~:text=In%20object%2Doriented%20computer%20p
rogramming,data%2C%20into%20a%20single%20unit.
Modular Programming: Definitions, benefits, and predictions. Blueprint - Blog by Tiny. (n.d.). Retrieved March 31,
2023, from https://www.tiny.cloud/blog/modular-programming-
principle/#:~:text=What%20is%20modular%20programming%3F,single%20aspect%20of%20the%20functio
nality.
What is polymorphism? Educative. (n.d.). Retrieved March 31, 2023, from
https://www.educative.io/answers/what-is-polymorphism
Rajinikanth. (n.d.). Java programming. Java Tutorials - Benefits and Costs of Inheritance. Retrieved March 31,
2023, from http://www.btechsmartclass.com/java/java-benefits-and-costs-of-inheritance.html

More Related Content

PPTX
Oops in vb
PDF
oopsinvb-191021101327.pdf
PDF
What is Object-Oriented Programming (OOP) and Why Do We Need It?
PPTX
OOP Concepts.paper presentation. In computer science
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PDF
Oops concepts
PDF
Top 30 Technical interview questions
PPTX
Java ppt.pptxkkkkkkkkkkkkkkkkkkkkkkkkkkk
Oops in vb
oopsinvb-191021101327.pdf
What is Object-Oriented Programming (OOP) and Why Do We Need It?
OOP Concepts.paper presentation. In computer science
Procedural-vs-Object-Oriented-Programming (1).pdf
Oops concepts
Top 30 Technical interview questions
Java ppt.pptxkkkkkkkkkkkkkkkkkkkkkkkkkkk

Similar to What is OOP_ (Object Oriented Programming) (1).pptx (20)

PPTX
Chapter-3 Scoping.pptx
PPT
Unit 1- Basic concept of object-oriented-programming.ppt
PDF
PPTX
OOP interview questions & answers.
PPTX
Object oriented programing
PPT
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
PPTX
Block_1_Unit- I.pdf bca learning for exam you
PPTX
object oriented programming(oops)
PDF
EEE oops Vth semester viva questions with answer
PPTX
The Four Pillars of Object-Oriented Programming
PPTX
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
PPTX
Unit 1 OOSE
PDF
Diving into OOPs_ Key Concepts and Principles (1).pdf
PDF
OOPS_Unit_1
PPTX
java oops and java very important for .pptx
PPTX
java oops compilation object class inheritance.pptx
PDF
Oop basic overview
PDF
software engineer interview questions.pdf
PPTX
Features of Object Oriented Programming.pptx
Chapter-3 Scoping.pptx
Unit 1- Basic concept of object-oriented-programming.ppt
OOP interview questions & answers.
Object oriented programing
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
Block_1_Unit- I.pdf bca learning for exam you
object oriented programming(oops)
EEE oops Vth semester viva questions with answer
The Four Pillars of Object-Oriented Programming
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
Unit 1 OOSE
Diving into OOPs_ Key Concepts and Principles (1).pdf
OOPS_Unit_1
java oops and java very important for .pptx
java oops compilation object class inheritance.pptx
Oop basic overview
software engineer interview questions.pdf
Features of Object Oriented Programming.pptx
Ad

Recently uploaded (20)

PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPT
Quality review (1)_presentation of this 21
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
1_Introduction to advance data techniques.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
Database Infoormation System (DBIS).pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
Lecture1 pattern recognition............
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
climate analysis of Dhaka ,Banglades.pptx
oil_refinery_comprehensive_20250804084928 (1).pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Quality review (1)_presentation of this 21
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
1_Introduction to advance data techniques.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Clinical guidelines as a resource for EBP(1).pdf
Database Infoormation System (DBIS).pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Lecture1 pattern recognition............
Miokarditis (Inflamasi pada Otot Jantung)
Fluorescence-microscope_Botany_detailed content
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Supervised vs unsupervised machine learning algorithms
Ad

What is OOP_ (Object Oriented Programming) (1).pptx

  • 1. What is OOP? (Object Oriented Programming) BY: HREEM P.
  • 2. Fundamentals and Outline of OOP In simplest terms, OOP (Object Oriented Programming) can be defined as a programming model that organizes software design around objects and classes rather then functions and logic as is used in language such as Python. One of the biggest and most popular OOP languages is Java.There are many fundamental concepts that make up OOP and these concepts are adapted by most OOP languages in order to maximize the potential of the language they are as follows: ▸ Encapsulation ▸ Modularity ▸ Polymorphism ▸ Inheritance These concepts will be explained with detail in the following slides along with other key concepts/questions about OOP 2
  • 3. Encapsulation Encapsulation in OOP is a way for the program to not have access or restrict certain components of an object so that the user cannot access variables of a particular object. Encapsulation can hide data methods/functions/members associated with an object. It allows for the bundling of data (variables) along with methods that act on it into a single unit to be used Why is Encapsulation useful? There are a few key benefits of encapsulation as follows: Allows for hidden data: It allows for privacy of a user’s program as other users will not know how the classes is being stored or implemented but only the values that are being passed or initialized More flexible and efficient: It allows for variable names to be write-only so that you can omit accessor methods such as getYear() Easily reused: It allows the user to easily change and adapt to new input requirements 3 A pictogram illustrating the use of encapsulation Write-Only Variables: A variable in which a value can be assigned but cannot be accessed as there is no accessor for that variable
  • 4. Modularity Another fundamental of OOP is modularity. Modularity can be defined as a technique of programming in which a program’s functionality is split into independent and interchangeable modules, so that each module contains all the logic necessary to execute one part of the desired output of the program. Modules can be thought of as pieces of a puzzle, and once all put together, a finished image is revealed What are the benefits of Modularity? Program is easier to read: It allows for another user to read your program easily and efficiently as potentially larger program is split up into smaller modules/files each with its own purpose. This also allows for your files to be smaller taking up less space on your hard disk Program is easier to test/debug: When splitting the program into smaller files, testing/debugging of the code is easier as tests/debugging can be more detailed for smaller programs/files which allows for the bug to be solved faster, or the test to be run smoother Easily find code/More organized: In modules, similar code is grouped together in order to maximize the functionality of the module. This firstly, allows chunks of coed to be found more easily as you know which module does a specific functionality and secondly allows for more organized coding environment leading to less bugs in your code. 4
  • 5. Polymorphism Polymorphism is one of the bigger fundamental concepts of OOP. It can be defined as the ability of a variable, function, object etc. in a program to take on multiple forms. An example is it allows different objects in a program to behave as if they were the same. There are two types of polymorphism that are common and are as follows What are the types of Polymorphism? Compile time Polymorphism: In this polymorphism, the type of an object is known at the compile time which allowed for the compiler to use an appropriate implementation usually through a technique known as method overloading Runtime Polymorphism: In this polymorphism, the implementation of a function or method is determined at runtime based on the actual type of the object. This is usually achieved through inheritance What are the benefits of Polymorphism? Versatility of variables: It allows for a single variable name to store variables of multiple data types Allows for code to be reused/repurposed: It allows for the reuse of existing code by allowing objects of different classes to be treated as if they are of the same class. 5 Method Overloading: When multiple methods can have the same name with different variables Inheritance: When a class is derived/elements are gotten from another class
  • 6. Inheritance Inheritance can be defined as when a class derives methods, functions from another class. The class that “inherits” these functionality is known as a child class and the class from which it drives it from is known as the parent class. A child class can inherit methods from a parent class while still having its own unique methods What are the benefits of Inheritance? Code reuse: An obvious benefit based on the definition is the fact that code can be reused as when a child class inherits something from a parent class, it does not need to be rewritten. Efficient coding: While inheriting, you can override/adjust methods of the parent class and adapt them to the child class allowing for versatility in your coding (maintaining the useful elements of a parent class while ignoring the extra elements) How are Inheritance and Polymorphism related? Inheritance and polymorphism work hand in hand as during run-time polymorphism, a child class can be treated as objects of its parent class. This allows the child class to derive functionalities of its parent class which allows the type of the child and parent class to be determined at runtime (a feature of runtime polymorphism) 6 A pictogram illustrating the implementation of inheritance
  • 7. What is the Difference between Private, Public and Protected Members, Accessors and Modifiers? Private, public or protected members, accessors and modifiers while they have different functionalities the accessibility of them remain depending on whether they are private, public or protected. Hence defining these terms in correlation to what they mean with members will explain the difference between them Members: Members are also known as instance variables and are declared in a class with a type and are used later in methods, constructors etc. Private: Private members can only be accessed within the class in which they are declared. They cannot be accessed by any other class or object. They are usually used ONLY in the class they are needed hence why they are private (because no other class needs access to them). You must declare a member to be private using the private keyword before the variable type Public: Public members are accessible from anywhere in the program, including from outside the class. Protected: Protected members are similar to private members, but can also be accessed by child classes. They are typically used for variables that are needed in 7 Class Hierarchy: A series of parent and child classes all interconnected
  • 8. Accessors: Accessors are used to obtain and modify the values of members (instance variables). However, they are only limited to accessing private and protected members. Accessors allow a level of encapsulation as it limits/controls a class to how much code can be modified by external classes/factors Modifiers: Modifiers are keywords used to describe a class and specify properties characteristics of them. Some of these keywords include: - Static - Virtual - Final - Abstract 8 What is the Difference between Private, Public and Protected Members, Accessors and Modifiers?
  • 9. An Outline of the Paradigm Shift that Occurred in the Move from Procedural Programming to OOP The paradigm shift that occurs when we moved from procedural programming to OOP is significant in that both ways of programming are unique from one another however, they can both be used in the same language. Procedural programming was focused on writing procedures and functions that manipulated data. It is a more structured way of programming that involves creating a step-by-step procedure that executes a series of instructions OOP is focused on creating objects that encapsulate both data and behavior. It allows for a more dynamic program that is versatile and can take a variety of inputs. It creates a blueprint that makes it easier for more specific program endeavours This paradigm shift allowed for code to be reusable and allowed flexibility the program. It also helped to modify and write previous programs that would otherwise take way too long or too many lines to code. It also helped maintain the code and allowed it be more versatile. 9 Paradigm: Different ways or style a program can be organized (procedural and OOP)
  • 10. The Advantages of OOP over Earlier Paradigms 10 There are many advantages to OOP as opposed to other paradigms. Some of them are as follows: Code Organization: OOP enables the programmer to use objects and classes to organize their code. This allows for code to be broken into section each with its own purpose. This also indirectly organizes the code to be more readable for other users Modularity: Bootlegging off of the previous advantage, the organization of code in OOP often comes through making different modules and files for chunks of code that are similar. By doing this it is easier to develop, debug and test certain parts of the code as you can run more specific tests, or find a certain module in which the bug is occurring, leaving you with less code to debug. Code Reusability: OOP emphasizes and allows code to be reused through inheritance and polymorphism (as stated before). This reduces code duplication and promotes code reuse, leading to and efficient development of code Modelling after the real life concepts and the world: OOP allows real life concepts such as maintaining a bank account to be modelled in code through its use of objects and classes. This allows for real life programming issues to be tackled more easily as there is a way to organize and structure code with OOP. All in all, with all of the advantages OOP presents, there is no doubt as to why many software developers choose to use this paradigm. OOP is mainly used for large scale projects that require a lot more time and debugging if other paradigms were used. With that being said, other paradigms also have their benefits that OOP does not and OOP and other paradigms should both be considered when one is programming
  • 11. Citations 11 Gillis, A. S., & Lewis, S. (2021, July 13). What is object-oriented programming (OOP)? App Architecture. Retrieved March 31, 2023, from https://www.techtarget.com/searchapparchitecture/definition/object-oriented- programming-OOP Encapsulation - definition & overview. Sumo Logic. (n.d.). Retrieved March 31, 2023, from https://www.sumologic.com/glossary/encapsulation/#:~:text=In%20object%2Doriented%20computer%20p rogramming,data%2C%20into%20a%20single%20unit. Modular Programming: Definitions, benefits, and predictions. Blueprint - Blog by Tiny. (n.d.). Retrieved March 31, 2023, from https://www.tiny.cloud/blog/modular-programming- principle/#:~:text=What%20is%20modular%20programming%3F,single%20aspect%20of%20the%20functio nality. What is polymorphism? Educative. (n.d.). Retrieved March 31, 2023, from https://www.educative.io/answers/what-is-polymorphism Rajinikanth. (n.d.). Java programming. Java Tutorials - Benefits and Costs of Inheritance. Retrieved March 31, 2023, from http://www.btechsmartclass.com/java/java-benefits-and-costs-of-inheritance.html