SlideShare a Scribd company logo
1 of 11
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

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

SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsGaruda Trainings
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
software engineer interview questions.pdf
software engineer interview questions.pdfsoftware engineer interview questions.pdf
software engineer interview questions.pdfRaajpootQueen
 
Features of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxFeatures of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxSwagatoBiswas
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cfloraaluoch3
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview QuestionsKuntal Bhowmick
 
Lesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLuiFlor
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaMadishetty Prathibha
 
object oriented programming(syed munib ali 11b-023-bs)
object oriented programming(syed munib ali 11b-023-bs)object oriented programming(syed munib ali 11b-023-bs)
object oriented programming(syed munib ali 11b-023-bs)munibali55
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersSatyam Jaiswal
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programmingPraveen Chowdary
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfHouseMusica
 

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

SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
 
object oriented programming(oops)
object oriented programming(oops)object oriented programming(oops)
object oriented programming(oops)
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
Oop
OopOop
Oop
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
Oop basic overview
Oop basic overviewOop basic overview
Oop basic overview
 
software engineer interview questions.pdf
software engineer interview questions.pdfsoftware engineer interview questions.pdf
software engineer interview questions.pdf
 
Features of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptxFeatures of Object Oriented Programming.pptx
Features of Object Oriented Programming.pptx
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Lesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptxLesson 1 - Object Oriented Programming CPP103.pptx
Lesson 1 - Object Oriented Programming CPP103.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
 
object oriented programming(syed munib ali 11b-023-bs)
object oriented programming(syed munib ali 11b-023-bs)object oriented programming(syed munib ali 11b-023-bs)
object oriented programming(syed munib ali 11b-023-bs)
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 

Recently uploaded

ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookvip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookmanojkuma9823
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxFurkanTasci3
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Bookvip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
vip Sarai Rohilla Call Girls 9999965857 Call or WhatsApp Now Book
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptx
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 

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