PHP implementation for Headfirst Design Patterns
book examples.
Definition
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
OO Principle
Classes should be open for extension but closed for modification.
Definition
Defines an interface for creating an object, but lets subclasses decide witch class to instantiate.
Factory Method lets a defer instantiation to subclasses.
OO Principle [Dependency Inversion]
Depend upon abstractions. Do not depend upon concrete classes.
Definition
provides an interface for creating families of related or dependent objects without specifying their concrete classes.
Definition
Ensures that a class has only one instance, and provides a global point of access to it.