PHP Patterns: The Composite Pattern

A while ago, I covered The Observer Pattern, a really useful pattern, particularly when it comes to event-handling systems.

Today, I’m going to take a look at the Composite Pattern, another really useful pattern that allows you to treat individual objects and collections of those objects as if they were the same. That may sound a little strange, but we’ll look at a concrete example, which should help clarify things: a List-based system.

Continue reading “PHP Patterns: The Composite Pattern”