Everything About ___
Live briefing

Everything about Decorator pattern

Design pattern in object-oriented programming

In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object dynamically, without affecting the behavior of other instances of the same class. The decorator pattern is often useful for adhering to the Single Responsibility Principle, as it enables functionality to be distributed across classes with distinct concerns. It also supports the Open–Closed Principle, since a class's functionality can be extended without modifying its source code. Using decorators can be more flexible and efficient than subclassing, as an object's behavior can be augmented or combined at runtime without creating an entirely new class hierarchy. Wikipedia →

🧭 Start here: a 6-step reading path

  1. Read the overview: Decorator patternA 5-minute orientation
  2. Skim a recent paper: Effects of salinity on larval survival and development of the decorator crab Camposcia retusa and food consumption patterns of megalopaeInfluential work since 2022
  3. Pick up a classic book: Pattern designThe most-reprinted book on the subject
  4. Read the landmark paper: Decorator Pattern in Web ApplicationCited 3 times
  5. Go sideways: Bridge patternA closely related topic
  6. Go sideways: Factory method patternA closely related topic

📖 Definitions

Noun A structural (and partitioning) design pattern that allows behaviour to be added to an existing object dynamically.

🏆 Landmark papers (most cited)

🆕 Influential since 2022

📚 Books worth reading

Ranked by number of editions on Open Library, a rough measure of how lasting a book is.

🔗 Related topics