Table of Contents
Easing into the Fundamentals of Design Patterns
Chapter 1 PHP and Object-Oriented Programming
- Entering into Intermediate and Advanced Programming
- Why Object-Oriented Programming?
- Classes and Objects
- The Client as a Requester Class
- What About Speed?
- What’s Wrong with Sequential and Procedural Programming?
Chapter 2 Basic Concepts in OOP
- Easy Does It
Chapter 3 Basic Design Pattern Concepts
- The MVC Loosens and Refocuses Programming
- Basic Principles of Design Patterns
- Design Patterns as a Big Cheat Sheet
- Choosing a Design Pattern
Chapter 4 Using UMLs with Design Patterns
- Why Unified Modeling Language (UML)?
- Class Diagrams
- Participant Symbols
- Relationship Notations
- Object Diagrams
- Interaction Diagrams
- The Role of Diagrams and Notations in Object-Oriented Programming
- Tools for UMLs
- Other UMLs
Creational Design Patterns
Chapter 5 Factory Method Design Pattern
- What Is the Factory Method Pattern?
- When to Use the Factory Method
- A Minimalist Example
- Accommodating Class Changes
Chapter 6 Prototype Design Pattern
- What Is the Prototype Design Pattern?
- When to Use the Prototype Pattern
- The Clone Function
- A Minimalist Prototype Example
- Adding OOP to the Prototype
- The Prototype in PHP Land
Structural Design Patterns
Chapter 7 The Adapter Pattern
- What Is the Adapter Pattern?
- When to Use the Adapter Pattern
- The Adapter Pattern Using Inheritance
- The Adapter Pattern Using Composition
Chapter 8 Decorator Design Pattern
- What Is the Decorator Pattern?
- When to Use the Decorator Pattern
- Minimalist Decorator
- What About Wrappers?
- Decorators with Multiple Components
- HTML User Interface (UI)
Behavioral Design Patterns
Chapter 9 The Template Method Pattern
- What Is the Template Method Pattern?
- When to Use the Template Method
- Using the Template Method with Images and Captions: A Minimal Example
- The Client
- The Hollywood Principle
- Using the Template Method with Other Design Patterns
- The Factory Method Participants
- The Hook in the Template Method Design Pattern
- The Small and Mighty Template Method
Chapter 10 The State Design Pattern
- What Is the State Pattern?
- When to Use the State Pattern?
- The State Machine
- Light On, Light Off: The Minimal State Design Pattern
- Adding States
- The Navigator: More Choices and Cells
- The State Pattern and PHP
MySQL and PHP Design Patterns
Chapter 11 A Universal Class for Connections and a Proxy Pattern for Security
- A Simple Interface and Class for MySQL
- The Protection Proxy for Login
- The Proxy and Real-World Security
Chapter 12 The Flexibility of the Strategy Design Pattern
- Encapsulating Algorithms
- A Minimalist Strategy Pattern
- Expanded Strategy Pattern with Data Security and Parameterized Algorithms
- The Flexible Strategy Pattern
Chapter 13 The Chain of Responsibility Design Pattern
- Passing the Buck
- The Chain of Responsibility in a MySQL Help Desk
- Automated Chain of Responsibility and Factory Method
- Ease of Update
Chapter 14 Building a Multidevice CMS with the Observer Pattern
- Built-In Observer Interfaces
- When to Use the Observer Pattern
- Using SPL with the Observer Pattern
- Free Range PHP and the Observer Pattern
- Making a Simple CMS
- Thinking OOP