Polski

Structural patterns

Decorator

Adds behaviour by wrapping an object instead of multiplying subclasses.

Article

Decorator – adding behaviour layer by layer

Decorator wraps an object in another object with the same interface and adds behaviour before or after the call. An example of caching, retries and logging for an exchange rate provider in C#, TypeScript, Java, Go and Python.

Related articles

Challenges

Around the topic

In this group: Structural patterns