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

PDF
Oops concepts
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PPTX
Object Oriented Programming - Cheat sheet.pptx
PDF
L1-Introduction to OOPs concepts.pdf
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
PPTX
An overview of Object Oriented Programming in C#.
PPT
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
PPTX
Chapter 04 object oriented programming
Oops concepts
Procedural-vs-Object-Oriented-Programming (1).pdf
Object Oriented Programming - Cheat sheet.pptx
L1-Introduction to OOPs concepts.pdf
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
An overview of Object Oriented Programming in C#.
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
Chapter 04 object oriented programming

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

PDF
6_Object-oriented-using-java.pdf object oriented programming concepts
DOC
Questpond - Top 10 Interview Questions and Answers on OOPS
PPTX
Presentation c
PDF
1unit-120324103142-phpapp02.pdf
PPTX
introduction of Object oriented programming
PPTX
PPTX
SKILLWISE - OOPS CONCEPT
PPTX
Intro to object oriented programming.pptx
PPT
2 Object Oriented Programming
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
Need of object oriented programming
ODP
Ayush oops
PPTX
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
PPTX
POP vs OOP Introduction
PPTX
Object Oriented Programming Concepts Using C++
PPTX
Introduction to Object Oriented Programming
PPT
Oops And C++ Fundamentals
PPTX
OOP Concepts.paper presentation. In computer science
PPT
Share Unit 1- Basic concept of object-oriented-programming.ppt
6_Object-oriented-using-java.pdf object oriented programming concepts
Questpond - Top 10 Interview Questions and Answers on OOPS
Presentation c
1unit-120324103142-phpapp02.pdf
introduction of Object oriented programming
SKILLWISE - OOPS CONCEPT
Intro to object oriented programming.pptx
2 Object Oriented Programming
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
Need of object oriented programming
Ayush oops
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
POP vs OOP Introduction
Object Oriented Programming Concepts Using C++
Introduction to Object Oriented Programming
Oops And C++ Fundamentals
OOP Concepts.paper presentation. In computer science
Share Unit 1- Basic concept of object-oriented-programming.ppt
Ad

Recently uploaded (20)

PPTX
Azure Data management Engineer project.pptx
PPTX
LESSON-1-NATURE-OF-MATHEMATICS.pptx patterns
PDF
A Systems Thinking Approach to Algorithmic Fairness.pdf
PDF
AI Lect 2 Identifying AI systems, branches of AI, etc.pdf
PDF
Data Science Trends & Career Guide---ppt
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
Moving the Public Sector (Government) to a Digital Adoption
PPTX
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
PDF
Taxes Foundatisdcsdcsdon Certificate.pdf
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
PPTX
Purple and Violet Modern Marketing Presentation (1).pptx
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PDF
345_IT infrastructure for business management.pdf
PPT
Performance Implementation Review powerpoint
PPTX
1intro to AI.pptx AI components & composition
PPTX
batch data Retailer Data management Project.pptx
PDF
Mastering Financial Analysis Materials.pdf
PDF
Data Analyst Certificate Programs for Beginners | IABAC
PPTX
Logistic Regression ml machine learning.pptx
PDF
Foundation of Data Science unit number two notes
Azure Data management Engineer project.pptx
LESSON-1-NATURE-OF-MATHEMATICS.pptx patterns
A Systems Thinking Approach to Algorithmic Fairness.pdf
AI Lect 2 Identifying AI systems, branches of AI, etc.pdf
Data Science Trends & Career Guide---ppt
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
Moving the Public Sector (Government) to a Digital Adoption
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
Taxes Foundatisdcsdcsdon Certificate.pdf
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
Purple and Violet Modern Marketing Presentation (1).pptx
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
345_IT infrastructure for business management.pdf
Performance Implementation Review powerpoint
1intro to AI.pptx AI components & composition
batch data Retailer Data management Project.pptx
Mastering Financial Analysis Materials.pdf
Data Analyst Certificate Programs for Beginners | IABAC
Logistic Regression ml machine learning.pptx
Foundation of Data Science unit number two notes
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