1.3. Design Pattern Demonstration

Most examples of Design Patterns historically have been very sparse and theoretical so as not to have the reader confuse the core concepts with language-agnostic features. Readers who have studied Design Patterns, or even Object Oriented Programming before will be very familiar with the ever-present square, circle, and oval object examples.

The debate rages on about Design Pattern books using simple objects like squares or people in their examples. Purists say you should detail the Design Pattern concepts and practice and give the simplest examples possible so as not to distract from the actual implementation of the pattern. (These are the people that hated story problems in math class because of all the extra information!) In my experience, self-taught PHP programmers prefer to see more thorough examples of the concept in code form. (They probably learned a lot by copy and paste coding when they first started.)

The Design Patterns in this book do contain small to medium-sized examples of PHP code to demonstrate the pattern. This dual-phased approach combines the actual conceptual explanation of the pattern for those who need that particular structure with the example-based pattern demonstration for those who are more hands-on learners.

The reference pages of this book will be more satisfying to the purists, while the case study section at the end will satisfy the code-example-hungry readers. For more information on the references pages, skip ...

Get Professional PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.