Chapter 6. Decorator Pattern

One of the scariest phrases a programmer can hear is "This is a living requirements document." The client specifies that development needs to begin and continue throughout the requirements-gathering and specification creation phases. Even after these are complete, chances are that the client will come back and ask for just a few tweaks here and there. Since those changes seem small to the client, they do not expect the timeline for deployment to change with the addition of the enhancements. If not handled correctly, even these small tweaks can generate headaches. Whenever base functionality needs to be modified slightly, the Decorator Design Pattern is the optimal pick.

Name: Decorator

The Decorator Design Pattern is best suited for altering or decorating portions of an existing object's content or functionality without modifying the structure of the original object.

Get Professional PHP Design Patterns 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.