SlideShare a Scribd company logo
Object-Oriented Programming
(OOP)
MD. ATIKUR RAHMAN
PHP
Lecture - 01
Programmer, Silkcity Solution
Trainer, CBA IT
2
Agenda
o Object-Oriented Programming (OOP)
o Procedural programming
o Procedural programming vs OOP
o Features/Principles of OOP
o Advantages of using OOP
o Class
o Object
o Class vs Object
o Object Characteristics
Object-Oriented
Programming (OOP)
OOP is a programming paradigm based on the concept of "objects", which can
contain data and code. data in the form of fields, and code, in the form of
procedures.
A common feature of objects is that procedures are attached to them and can
access and modify the object's data fields
Note : The "Don't Repeat Yourself" (DRY) principle is about reducing the
repetition of code.
4
Procedural programming is a programming paradigm
built around the idea that programs are sequences of
instructions to be executed.
Procedural
programming
PP vs 00P
Procedural programming Object-Oriented Programming
Divided into small parts called functions. Divided into small parts called objects.
follows a top-down approach. follows a bottom-up approach.
No access specifier
Has access specifiers like private, public, protected,
etc.
Does not have any proper way of hiding data so it
is less secure.
Provides data hiding so it is more secure.
overloading is not possible. Overloading is possible
there is no concept of data hiding and inheritance. the concept of data hiding and inheritance is used.
5
PP vs 00P
Procedural programming Object-Oriented Programming
the function is more important than the data. data is more important than function.
based on the unreal world. based on the real world.
Used for designing medium-sized programs.
Used for designing large and complex
programs.
uses the concept of procedure abstraction. uses the concept of data abstraction.
Code reusability absent Code reusability present
Examples: C, FORTRAN, Pascal, Basic, etc. Exemples: C++, Java, Python, C#,PHP etc.
6
The main
Features/Principles
of OOP
Data
Abstraction
7
Inheritance Encapsulation
Polymorphism
Advantages of
using OOP
o OOPs is very helpful in solving very complex level of problems.
o Highly complex programs can be created, handled, and maintained easily
using object-oriented programming.
o OOPs, promote code reuse, thereby reducing redundancy.
o OOPs also helps to hide the unnecessary details with the help of Data
Abstraction.
o OOPs, are based on a bottom-up approach, unlike the Structural
programming paradigm, which uses a top-down approach.
o Polymorphism offers a lot of flexibility in OOPs.
 Class
 Object
 Properties
 Methods (or Functions)
9
Understand the
following terms
Class
A class is a blueprint. It is a piece of code describing how to
manage a topic or task in the way we want.
• It is a user-defined data type
• Inside a class, we define variables, constants, member functions, and other
functionality.
• it binds data and functions together in a single unit.
• It does not consume memory at run time.
Structuring Classes
declare a class using the class
keyword
followed by the name of the class and
a set of curly braces { }
<?php
class MyClass
{
// Class properties and methods
}
?>
Object
An object is a real-world entity that has attributes, behavior, and
properties. It is referred to as an instance of the class. It contains
member functions, variables that we have defined in the class. It
occupies space in the memory.
Different objects have different states or attributes, and behaviors.
Structuring Object
We created the object $myObject from
the class MyClass with the new keyword.
The process of creating an object is also
known as instantiation.
<?php
class MyClass
{
// Class properties and methods
}
$myObject = new MyClass();
?>
class vs object
class object
It is a logical entity. It is a real-world entity.
It is conceptual. It is real.
It binds data and methods together into a single unit. It is just like a variable of a class.
It does not occupy space in the memory. It occupies space in the memory.
It is a data type that represents the blueprint of an
object.
It is an instance of the class.
It is declared once. Multiple objects can be declared.
It uses the keyword class when declared. It uses the new keyword to create an object.
A class can exist without any object. Objects cannot exist without a class.
12
13
Object
Characteristics
objects share the two common key characteristics
o State
o Behavior
State tells us how the object looks or what properties
it has.
Behavior tells us what the object does.
Object holds its state in variables that are often referred to as
properties.
Object also exposes its behavior via functions or methods.
14
Object
Characteristics
example
A bank account has the state that
consists of
Account
Number
Balance Deposit Withdraw
A bank account also has the following
behaviors
Thank you

More Related Content

Similar to PHP OOP Lecture - 01.pptx

Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
Karudaiyar Ganapathy
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer ScienceObject Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
ShailendraPandey96
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
Sudip Simkhada
 
1 intro
1 intro1 intro
1 intro
abha48
 
OOP-1.pptx
OOP-1.pptxOOP-1.pptx
OOP-1.pptx
iansebuabeh
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
HouseMusica
 
OOPS
OOPSOOPS
130704798265658191
130704798265658191130704798265658191
130704798265658191
Tanzeel Ahmad
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
Jessica Deakin
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
Basic Concepts of Object Oriented Programming using C++
Basic Concepts of Object Oriented Programming using C++Basic Concepts of Object Oriented Programming using C++
Basic Concepts of Object Oriented Programming using C++
ShivamPathak318367
 
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
Madishetty Prathibha
 
Oop ppt
Oop pptOop ppt
Oop ppt
Shani Manjara
 
Object oriented programming
Object oriented programmingObject oriented programming
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
Questpond
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
Kanan Gandhi
 
OOP
OOPOOP
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Sandeep Kumar Singh
 
Object oriented programing
Object oriented programingObject oriented programing
Object oriented programing
Jamaluddin Malakzai
 

Similar to PHP OOP Lecture - 01.pptx (20)

Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer ScienceObject Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
1 intro
1 intro1 intro
1 intro
 
OOP-1.pptx
OOP-1.pptxOOP-1.pptx
OOP-1.pptx
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
 
OOPS
OOPSOOPS
OOPS
 
130704798265658191
130704798265658191130704798265658191
130704798265658191
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
 
Basic Concepts of Object Oriented Programming using C++
Basic Concepts of Object Oriented Programming using C++Basic Concepts of Object Oriented Programming using C++
Basic Concepts of Object Oriented Programming using C++
 
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
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
OOP
OOPOOP
OOP
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Object oriented programing
Object oriented programingObject oriented programing
Object oriented programing
 

Recently uploaded

Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
JezreelCabil2
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 

Recently uploaded (20)

Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 

PHP OOP Lecture - 01.pptx

  • 1. Object-Oriented Programming (OOP) MD. ATIKUR RAHMAN PHP Lecture - 01 Programmer, Silkcity Solution Trainer, CBA IT
  • 2. 2 Agenda o Object-Oriented Programming (OOP) o Procedural programming o Procedural programming vs OOP o Features/Principles of OOP o Advantages of using OOP o Class o Object o Class vs Object o Object Characteristics
  • 3. Object-Oriented Programming (OOP) OOP is a programming paradigm based on the concept of "objects", which can contain data and code. data in the form of fields, and code, in the form of procedures. A common feature of objects is that procedures are attached to them and can access and modify the object's data fields Note : The "Don't Repeat Yourself" (DRY) principle is about reducing the repetition of code.
  • 4. 4 Procedural programming is a programming paradigm built around the idea that programs are sequences of instructions to be executed. Procedural programming
  • 5. PP vs 00P Procedural programming Object-Oriented Programming Divided into small parts called functions. Divided into small parts called objects. follows a top-down approach. follows a bottom-up approach. No access specifier Has access specifiers like private, public, protected, etc. Does not have any proper way of hiding data so it is less secure. Provides data hiding so it is more secure. overloading is not possible. Overloading is possible there is no concept of data hiding and inheritance. the concept of data hiding and inheritance is used. 5
  • 6. PP vs 00P Procedural programming Object-Oriented Programming the function is more important than the data. data is more important than function. based on the unreal world. based on the real world. Used for designing medium-sized programs. Used for designing large and complex programs. uses the concept of procedure abstraction. uses the concept of data abstraction. Code reusability absent Code reusability present Examples: C, FORTRAN, Pascal, Basic, etc. Exemples: C++, Java, Python, C#,PHP etc. 6
  • 8. Advantages of using OOP o OOPs is very helpful in solving very complex level of problems. o Highly complex programs can be created, handled, and maintained easily using object-oriented programming. o OOPs, promote code reuse, thereby reducing redundancy. o OOPs also helps to hide the unnecessary details with the help of Data Abstraction. o OOPs, are based on a bottom-up approach, unlike the Structural programming paradigm, which uses a top-down approach. o Polymorphism offers a lot of flexibility in OOPs.
  • 9.  Class  Object  Properties  Methods (or Functions) 9 Understand the following terms
  • 10. Class A class is a blueprint. It is a piece of code describing how to manage a topic or task in the way we want. • It is a user-defined data type • Inside a class, we define variables, constants, member functions, and other functionality. • it binds data and functions together in a single unit. • It does not consume memory at run time. Structuring Classes declare a class using the class keyword followed by the name of the class and a set of curly braces { } <?php class MyClass { // Class properties and methods } ?>
  • 11. Object An object is a real-world entity that has attributes, behavior, and properties. It is referred to as an instance of the class. It contains member functions, variables that we have defined in the class. It occupies space in the memory. Different objects have different states or attributes, and behaviors. Structuring Object We created the object $myObject from the class MyClass with the new keyword. The process of creating an object is also known as instantiation. <?php class MyClass { // Class properties and methods } $myObject = new MyClass(); ?>
  • 12. class vs object class object It is a logical entity. It is a real-world entity. It is conceptual. It is real. It binds data and methods together into a single unit. It is just like a variable of a class. It does not occupy space in the memory. It occupies space in the memory. It is a data type that represents the blueprint of an object. It is an instance of the class. It is declared once. Multiple objects can be declared. It uses the keyword class when declared. It uses the new keyword to create an object. A class can exist without any object. Objects cannot exist without a class. 12
  • 13. 13 Object Characteristics objects share the two common key characteristics o State o Behavior State tells us how the object looks or what properties it has. Behavior tells us what the object does. Object holds its state in variables that are often referred to as properties. Object also exposes its behavior via functions or methods.
  • 14. 14 Object Characteristics example A bank account has the state that consists of Account Number Balance Deposit Withdraw A bank account also has the following behaviors