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

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

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

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