Chapter 7. Design patterns

7.1 Strategy 125
7.2 Adapter 128
7.3 Decorator 135
7.4 Null Object 139
7.5 Iterator 142
7.6 Composite 145
7.7 Summary 151

Not long ago, I was trying to get my son, age five, to ski. It started well: he saw his older sister skiing down a mild slope, and immediately became eager to show us how easily he could do the same thing.

He couldn’t, though. He insisted on putting his skis on in the middle of the slope, and immediately fell flat on his back. I told him it was a nice try, but he disagreed. He had simply lost all interest. I suggested we go lower where it was less challenging. Instead he insisted on going to the top. I humored him and we went up. He had one look down the slope and said, “It’s scary.”

Of course ...

Get PHP in Action: Objects, Design, Agility now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.