SlideShare ist ein Scribd-Unternehmen logo
1 von 13
OO PHP
Object Oriented PHP
OO PHP
 Object Oriented PHP




   Advantages over functional programming
• Systematic procedure for designing application by extracting nouns and verbs
   from specifications and using CRC (Classes, Responsibilities, Collaborators)
   Cards, then formation of a UML diagram.

• Much, much easier to maintain and add or change functionality

• Elimination of repetitious code - DRY (Don’t repeat yourself)

• Enables use of design patterns – super efficient algorithms that have evolved for
   accomplishing common OOP application functionality
Universal Modeling Language




(Horstmann, 2010)




                    Inheritance – “is a”
                    Aggregation – “has a”
                    Dependency – collaborating classes
                    Interface – contract for concrete implementation
Fundamental Concepts
•   Inheritance - extends
        override methods                              Object Oriented PHP for Beginners
                                                      http://www.killerphp.com/tutorials/object-oriented-php/
•   Setting Access Modifiers
    •   public, private, protected
    Use getter/setter methods and private instance
    variables (attributes)
•   Static Method or Attribute – belongs to the class,
    not the object instance (e.g., counters)
•   Scope resolution operator - error if cannot resolve
        Paamayim Nekudotayim*
    Referencing Parent Class – self::
    parent:: works with parent static or instance
    methods but not parent attributes, as well as
    $this-> refers to instance
    Constructors/Destructors – give a default value
    __construct($var=0){}
    Cloning Objects clone keyword and __clone()
                                                                                * Error Message in Hebrew
    method
                                                                                paam = One
•   Comparing Objects == vs. ===                                                ayim = Doubled
                                                                                nekudot = Dot
                                                                                ayim = Doubled
Cloning vs. Object references
Design Patterns
• The Strategy Pattern defines a family
   of algorithms, encapsulates each       • The Iterator Pattern provides a way to
   one, and makes them                     access the elements of an aggregate
   interchangeable (polymorphism).         object sequentially without exposing its
   Strategy lets the algorithm vary        underlying representation.
   independently from the clients that   • The Adaptor Pattern changes the
   use it.                                 interface of one or more classes
• The Template Method pattern allows • The Decorator Pattern attaches
  a programmer to define the skeleton      additional responsibilities to an object
  of an algorithm in a superclass and      dynamically. Decorators provide a
  delegate specific steps to a subclass.   flexible alternative to subclassing.
  Subclasses can redefine certain steps • The Singleton Pattern ensures a class
  of an algorithm without changing the     only has one instance and provides a
  algorithm's structure.                   global point of access to it.
Project Overview

  • Photo gallery
      Thumbnail view
    • Full image view
    • Comments
    • Pagination
Project Overview
• Administration Back End
    Login
  • Create Admin users
  • Upload images
    Delete Images
  • Review/Delete Comments
Objects
                             User
                             Photograph
                             Comment

These will also serve as database tables. Usually when you have a database
                   table you have an object for that table.


                         • Database
                         • singleton pattern and allows for
                             adaptor pattern use if database format
                             changes, e.g., from MySQL to Oracle
                             Session
                             Additional Requirements
                         • Pagination
                         • Thumbnail generation
UML Diagram
Helpful Links
Object Oriented PHP for Beginners
http://www.killerphp.com/tutorials/object-oriented-php/
References
Freeman, Eric., Freeman, Elisabeth, Sierra, K., Bates, B. (2004). Head first
design patterns. Sebastpol, CA: O’Reilly Media, Inc.

Horstmann, C. (2010). Big Java 4th edition. (pp. 512-513). United States of
America: John Wiley & Sons, Inc.

Koffman, E. (2010). Data structures: abstraction and design using Java. (pp.
685-694). United States of America: John Wiley & Sons, Inc.

Lynda.com. (2009, March 25). PHP with MySQL beyond the basics.
Retrieved from http://www.lynda.com/tutorial/653

Weitere ähnliche Inhalte

Was ist angesagt?

cpp-2013 #9 STL Algorithms Part 1
cpp-2013 #9 STL Algorithms Part 1cpp-2013 #9 STL Algorithms Part 1
cpp-2013 #9 STL Algorithms Part 1Amazon Web Services
 
Functional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerFunctional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerLuis Atencio
 
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...mporhel
 
Object Oriented Programming Languages
Object Oriented Programming LanguagesObject Oriented Programming Languages
Object Oriented Programming LanguagesMannu Khani
 
operator overloading in c++
operator overloading in c++operator overloading in c++
operator overloading in c++harman kaur
 
Very Small Tutorial on Terrier 3.0 Retrieval Toolkit
Very Small Tutorial on Terrier 3.0 Retrieval ToolkitVery Small Tutorial on Terrier 3.0 Retrieval Toolkit
Very Small Tutorial on Terrier 3.0 Retrieval ToolkitKavita Ganesan
 
Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Mahmoud Alfarra
 

Was ist angesagt? (10)

cpp-2013 #9 STL Algorithms Part 1
cpp-2013 #9 STL Algorithms Part 1cpp-2013 #9 STL Algorithms Part 1
cpp-2013 #9 STL Algorithms Part 1
 
Functional programming for the Advanced Beginner
Functional programming for the Advanced BeginnerFunctional programming for the Advanced Beginner
Functional programming for the Advanced Beginner
 
Metaprogramming ruby
Metaprogramming rubyMetaprogramming ruby
Metaprogramming ruby
 
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...
How to Make Robust and Scalable Modeling Workbenches with Sirius - EclipseCon...
 
Lecture 1 oop
Lecture 1 oopLecture 1 oop
Lecture 1 oop
 
Object Oriented Programming Languages
Object Oriented Programming LanguagesObject Oriented Programming Languages
Object Oriented Programming Languages
 
operator overloading in c++
operator overloading in c++operator overloading in c++
operator overloading in c++
 
OOP Basics
OOP BasicsOOP Basics
OOP Basics
 
Very Small Tutorial on Terrier 3.0 Retrieval Toolkit
Very Small Tutorial on Terrier 3.0 Retrieval ToolkitVery Small Tutorial on Terrier 3.0 Retrieval Toolkit
Very Small Tutorial on Terrier 3.0 Retrieval Toolkit
 
Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1
 

Ähnlich wie Object Oriented PHP Overview

SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2Julie Iskander
 
Design patterns
Design patternsDesign patterns
Design patternsAlok Guha
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptSanthosh Kumar Srinivasan
 
Introduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John MulhallIntroduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John MulhallJohn Mulhall
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsRanel Padon
 
Design patterns through refactoring
Design patterns through refactoringDesign patterns through refactoring
Design patterns through refactoringGanesh Samarthyam
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design Allan Mangune
 
Code reviews
Code reviewsCode reviews
Code reviewsRoger Xia
 
Code reviews
Code reviewsCode reviews
Code reviewsRoger Xia
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their applicationHiệp Tiến
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itlokeshpappaka10
 
Software Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSoftware Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSergey Aganezov
 

Ähnlich wie Object Oriented PHP Overview (20)

Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in Javascript
 
Introduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John MulhallIntroduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John Mulhall
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
 
Design patterns through refactoring
Design patterns through refactoringDesign patterns through refactoring
Design patterns through refactoring
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
Code reviews
Code reviewsCode reviews
Code reviews
 
dmBridge & dmMonocle
dmBridge & dmMonocledmBridge & dmMonocle
dmBridge & dmMonocle
 
Code reviews
Code reviewsCode reviews
Code reviews
 
AngularJS
AngularJSAngularJS
AngularJS
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their application
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
Software Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSoftware Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural Patterns
 

Mehr von Larry Ball

Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1Larry Ball
 
EISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityEISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityLarry Ball
 

Mehr von Larry Ball (6)

Swift
SwiftSwift
Swift
 
Angular js
Angular jsAngular js
Angular js
 
Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1
 
Php debugging
Php debuggingPhp debugging
Php debugging
 
EISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityEISA Considerations for Web Application Security
EISA Considerations for Web Application Security
 
jQueryUI
 jQueryUI jQueryUI
jQueryUI
 

Kürzlich hochgeladen

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Kürzlich hochgeladen (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Object Oriented PHP Overview

  • 2. OO PHP Object Oriented PHP Advantages over functional programming • Systematic procedure for designing application by extracting nouns and verbs from specifications and using CRC (Classes, Responsibilities, Collaborators) Cards, then formation of a UML diagram. • Much, much easier to maintain and add or change functionality • Elimination of repetitious code - DRY (Don’t repeat yourself) • Enables use of design patterns – super efficient algorithms that have evolved for accomplishing common OOP application functionality
  • 3. Universal Modeling Language (Horstmann, 2010) Inheritance – “is a” Aggregation – “has a” Dependency – collaborating classes Interface – contract for concrete implementation
  • 4. Fundamental Concepts • Inheritance - extends override methods Object Oriented PHP for Beginners http://www.killerphp.com/tutorials/object-oriented-php/ • Setting Access Modifiers • public, private, protected Use getter/setter methods and private instance variables (attributes) • Static Method or Attribute – belongs to the class, not the object instance (e.g., counters) • Scope resolution operator - error if cannot resolve Paamayim Nekudotayim* Referencing Parent Class – self:: parent:: works with parent static or instance methods but not parent attributes, as well as $this-> refers to instance Constructors/Destructors – give a default value __construct($var=0){} Cloning Objects clone keyword and __clone() * Error Message in Hebrew method paam = One • Comparing Objects == vs. === ayim = Doubled nekudot = Dot ayim = Doubled
  • 5.
  • 6. Cloning vs. Object references
  • 7. Design Patterns • The Strategy Pattern defines a family of algorithms, encapsulates each • The Iterator Pattern provides a way to one, and makes them access the elements of an aggregate interchangeable (polymorphism). object sequentially without exposing its Strategy lets the algorithm vary underlying representation. independently from the clients that • The Adaptor Pattern changes the use it. interface of one or more classes • The Template Method pattern allows • The Decorator Pattern attaches a programmer to define the skeleton additional responsibilities to an object of an algorithm in a superclass and dynamically. Decorators provide a delegate specific steps to a subclass. flexible alternative to subclassing. Subclasses can redefine certain steps • The Singleton Pattern ensures a class of an algorithm without changing the only has one instance and provides a algorithm's structure. global point of access to it.
  • 8. Project Overview • Photo gallery Thumbnail view • Full image view • Comments • Pagination
  • 9. Project Overview • Administration Back End Login • Create Admin users • Upload images Delete Images • Review/Delete Comments
  • 10. Objects User Photograph Comment These will also serve as database tables. Usually when you have a database table you have an object for that table. • Database • singleton pattern and allows for adaptor pattern use if database format changes, e.g., from MySQL to Oracle Session Additional Requirements • Pagination • Thumbnail generation
  • 12. Helpful Links Object Oriented PHP for Beginners http://www.killerphp.com/tutorials/object-oriented-php/
  • 13. References Freeman, Eric., Freeman, Elisabeth, Sierra, K., Bates, B. (2004). Head first design patterns. Sebastpol, CA: O’Reilly Media, Inc. Horstmann, C. (2010). Big Java 4th edition. (pp. 512-513). United States of America: John Wiley & Sons, Inc. Koffman, E. (2010). Data structures: abstraction and design using Java. (pp. 685-694). United States of America: John Wiley & Sons, Inc. Lynda.com. (2009, March 25). PHP with MySQL beyond the basics. Retrieved from http://www.lynda.com/tutorial/653