🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Decorator

In plain terms

A pattern adding behavior to objects by wrapping them.

Going deeper

The Decorator pattern attaches new responsibilities to an object dynamically by wrapping it, an alternative to subclassing. Wrappers add features layer by layer.

Under the hood

Composable and runtime-flexible; Java I/O streams and Python decorators are well-known examples.

Examples

Java I/O streams, Python decorators, middleware, UI enhancements.

Think of it like...

Like adding toppings to a coffee, each wrapper adds a feature without changing the base.

Feedback & Bug Report