Back
APIs
Design Patterns
The Abstract Factory Pattern
Forward


Design Patterns

Design patterns have been the hot thing in object-oriented design for a while now, and there's no sign of that changing any time soon. All the hype and the books can make them seem like a complicated thing, but don't worry - there's no need to be mystified by names like Singleton, Facade, Memento, or Observer and wonder what kind of a cult you're joining - it's really a very simple idea.

  • There are a lot of common problems in software design.
  • A lot of time has been spent solving those problems over and over again.
  • Let's recognize those common problems and document solutions for them.
  • And let's give those solutions names, so that people have a common language to discuss them.

That's it. Honest. Some of the solutions are complex, of course, because they solve complex problems - or because they solve a large class of problems in a clever, generic way.

Patterns aren't set-in-stone rules. They are blueprints, meant to be tweaked for particular situations, modified for specific problem domains, improved on, revisited, revised.

Let's walk through some common patterns that are useful in PHP.