Learning PHP Design Patterns

Af William Sanders
Detaljer O'Reilly Media, Incorporated
ISBN 9781449344917
Sprog Engelsk
Vælg mellem
Pris 337,00 kr.
Paperback

Ikke på lager

Ikke på lager. Bestil nu og få den leveret om ca. 12 hverdage

Build server-side applications more efficiently--and improve your PHP programming skills in the process--by learning how to use design patterns in your code. This book shows you how to apply several object-oriented patterns through simple examples, and demonstrates many of them in full-fledged working applications.

Learn how these reusable patterns help you solve complex problems, organize object-oriented code, and revise a big project by only changing small parts. With Learning PHP Design Patterns, you'll learn how to adopt a more sophisticated programming style and dramatically reduce development time.

Learn design pattern concepts, including how to select patterns to handle specific problems Get an overview of object-oriented programming concepts such as composition, encapsulation, polymorphism, and inheritance Apply creational design patterns to create pages dynamically, using a factory method instead of direct instantiation Make changes to existing objects or structure without having to change the original code, using structural design patterns Use behavioral patterns to help objects work together to perform tasks Interact with MySQL, using behavioral patterns such as Proxy and Chain of Responsibility Explore ways to use PHP's built-in design pattern interfaces

Dedication:;Preface; Audience; Assumptions This Book Makes; Contents of This Book; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments;Easing into the Fundamentals of Design Patterns;
Chapter 1: PHP and Object-Oriented Programming;
1.1 Entering into Intermediate and Advanced Programming;
1.2 Why Object-Oriented Programming?;
1.3 Classes and Objects;
1.4 The Client as a Requester Class;
1.5 What About Speed?;
1.6 What's Wrong with Sequential and Procedural Programming?;
Chapter 2: Basic Concepts in OOP;
2.1 Abstraction;
2.2 Encapsulation;
2.3 Inheritance;
2.4 Polymorphism;
2.5 Easy Does It;
Chapter 3: Basic Design Pattern Concepts;
3.1 The MVC Loosens and Refocuses Programming;
3.2 Basic Principles of Design Patterns;
3.3 Design Patterns as a Big Cheat Sheet;
3.4 Choosing a Design Pattern;
Chapter 4: Using UMLs with Design Patterns;
4.1 Why Unified Modeling Language (UML)?;
4.2 Class Diagrams;
4.3 Participant Symbols;
4.4 Relationship Notations;
4.5 Object Diagrams;
4.6 Interaction Diagrams;
4.7 The Role of Diagrams and Notations in Object-Oriented Programming;
4.8 Tools for UMLs;
4.9 Other UMLs;Creational Design Patterns;
Chapter 5: Factory Method Design Pattern;
5.1 What Is the Factory Method Pattern?;
5.2 When to Use the Factory Method;
5.3 A Minimalist Example;
5.4 Accommodating Class Changes;
Chapter 6: Prototype Design Pattern;
6.1 What Is the Prototype Design Pattern?;
6.2 When to Use the Prototype Pattern;
6.3 The Clone Function;
6.4 A Minimalist Prototype Example;
6.5 Adding OOP to the Prototype;
6.6 The Prototype in PHP Land;Structural Design Patterns;
Chapter 7: The Adapter Pattern;
7.1 What Is the Adapter Pattern?;
7.2 When to Use the Adapter Pattern;
7.3 The Adapter Pattern Using Inheritance;
7.4 The Adapter Pattern Using Composition;
Chapter 8: Decorator Design Pattern;
8.1 What Is the Decorator Pattern?;
8.2 When to Use the Decorator Pattern;
8.3 Minimalist Decorator;
8.4 What About Wrappers?;
8.5 Decorators with Multiple Components;
8.6 HTML User Interface (UI);Behavioral Design Patterns;
Chapter 9: The Template Method Pattern;
9.1 What Is the Template Method Pattern?;
9.2 When to Use the Template Method;
9.3 Using the Template Method with Images and Captions: A Minimal Example;
9.4 The Client;
9.5 The Hollywood Principle;
9.6 Using the Template Method with Other Design Patterns;
9.7 The Factory Method Participants;
9.8 The Hook in the Template Method Design Pattern;
9.9 The Small and Mighty Template Method;
Chapter 10: The State Design Pattern;
10.1 What Is the State Pattern?;
10.2 When to Use the State Pattern?;
10.3 The State Machine;
10.4 Light On, Light Off: The Minimal State Design Pattern;
10.5 Adding States;
10.6 The Navigator: More Choices and Cells;
10.7 The State Pattern and PHP;MySQL and PHP Design Patterns;
Chapter 11: A Universal Class for Connections and a Proxy Pattern for Security;
11.1 A Simple Interface and Class for MySQL;
11.2 The Protection Proxy for Login;
11.3 The Proxy and Real-World Security;
Chapter 12: The Flexibility of the Strategy Design Pattern;
12.1 Encapsulating Algorithms;
12.2 A Minimalist Strategy Pattern;
12.3 Expanded Strategy Pattern with Data Security and Parameterized Algorithms;
12.4 The Flexible Strategy Pattern;
Chapter 13: The Chain of Responsibility Design Pattern;
13.1 Passing the Buck;
13.2 The Chain of Responsibility in a MySQL Help Desk;
13.3 Automated Chain of Responsibility and Factory Method;
13.4 Ease of Update;
Chapter 14: Building a Multidevice CMS with the Observer Pattern;
14.1 Built-In Observer Interfaces;
14.2 When to Use the Observer Pattern;
14.3 Using SPL with the Observer Pattern;
14.4 Free Range PHP and the Observer Pattern;
14.5 Making a Simple CMS;
14.6 Thinking OOP;Colophon;