Decorator Pattern Implementor

Implement the Decorator pattern to attach additional responsibilities to objects dynamically, providing a flexible alternative to subclassing. Use when you need to add behaviors like logging, caching, validation, authentication, compression, or UI embellishments without creating a subclass for every combination. Addresses the subclass explosion problem through transparent enclosure — decorators conform to the component interface so clients cannot distinguish decorated from undecorated objects. Covers composition order effects and the lightweight-decorator optimization. Triggers when: adding optional behaviors to objects at runtime, wrapping streams or middleware, layering cross-cutting concerns, needing to mix and match responsibilities without combinatorial subclass growth.

bookforge-ai Updated 42 repo stars
Sheldon the robot reading a BookForge book

File contents

bookforge-ai/bookforge-skills commit c10cb24838

Frequently asked questions

npx get-skill add bookforge-ai/decorator-pattern-implementor