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 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.