Section 7.1. Hacks 6778: Introduction


7.1. Hacks 6778: Introduction

In 1994, Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides published Design Patterns (Addison Wesley). The book quickly became a computer science classic because of its useful material, and it even pioneered a new metalanguage in the engineering and architecture communities. The book's underlying principle, which was to provide a set of patterns of object structure and intra-object structure, was adopted from building architecture and was smoothly applied to programming.

The set of 40 patterns presented in the book were gleaned from years of experience. Each pattern was presented in a language-neutral form, and most could be applied to any development environment.

A few of the patterns, such as the Iterator pattern, were specifically developed to make up for shortcomings in a language (in the case of Iterator, that language was C++). PHP implements the Iterator pattern inherently through the foreach method.


Patterns have been notoriously underused in PHP. Not until the advent of PHP 5 were the language and environment taken seriously in the enterprise software development community. Now, with a robust object model, solid IDEs, and wide developer adoption, the enterprise community is starting to notice PHP. Several books on PHP have recently covered the use of patterns in the language, and I think it's worth visiting them here.

In this book, I chose to use the original Design Patterns book as reference. I chose a subset of patterns from that book to implement here; these patterns and their implementations are solid architectural foundations, as well as sources of inspiration for your own code.



PHP Hacks
PHP Hacks: Tips & Tools For Creating Dynamic Websites
ISBN: 0596101392
EAN: 2147483647
Year: 2006
Pages: 163

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net