Decorator pattern

/ˈdɛkəreɪtər ˈpætərn/ noun

A design pattern that allows behavior to be added to objects dynamically without altering their structure by wrapping them in decorator objects. Each decorator implements the same interface as the original object and can add functionality before or after delegating to the wrapped object.

Named after the concept of decorating (adding ornaments to) something without changing its core structure, formalized in the Gang of Four book (1994). The pattern provides an alternative to subclassing for extending functionality, avoiding the 'explosion of subclasses' problem.

📖 Full word page — etymology, 47 translations, audio 🔑 Get Free API Key — 50 lookups/day 📚 Read the Docs — integrate Word Orb