Skip to Content
Learning PHP Design Patterns
book

Learning PHP Design Patterns

by William Sanders
February 2013
Intermediate to advanced content levelIntermediate to advanced
362 pages
8h 16m
English
O'Reilly Media, Inc.
Content preview from Learning PHP Design Patterns

Part IV. Behavioral Design Patterns

Great discoveries and improvements invariably involve the cooperation of many minds. I may be given credit for having blazed the trail, but when I look at the subsequent developments I feel the credit is due to others rather than to myself.

Alexander Graham Bell

When new turns of behavior cease to appear in the life of the individual, its behavior ceases to be intelligent.

Thomas Carlyle

Societies have always been shaped more by the nature of the media by which men communicate than by the content of the communication.

Marshall McLuhan

Behavioral design patterns make up the plurality of design patterns offered by the Gang of Four. This section covers one class example (Template Method) and one object example (State), but Part V shows more behavioral patterns used with PHP/MySQL examples. All in all, Gamma, Helm, Johnson, and Vlissides provide eleven behavioral patterns:

  • Chain of Responsibility

  • Command

  • Interpreter (class type)

  • Iterator

  • Mediator

  • Memento

  • Observer

  • State

  • Strategy

  • Template Method (class type)

  • Visitor

The key to understanding behavioral design patterns is communication. The focus shifts from the objects and classes that make up a design pattern to the communication between objects and classes. In the truest form of composition, behavioral patterns are best understood in terms of how objects work together to perform tasks.

Behavioral patterns focus on communication between pattern participants

Figure 50. Behavioral patterns ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering PHP Design Patterns

Mastering PHP Design Patterns

Junade Ali
Domain-Driven Design in PHP

Domain-Driven Design in PHP

Keyvan Akbary, Carlos Buenosvinos, Christian Soronellas

Publisher Resources

ISBN: 9781449344900Supplemental ContentErrata PagePurchase book