GoF-Decorator Pattern

Details
Full Name

GoF Decorator Pattern (Structural)

Also known as

Wrapper

Intent:

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing.

When to Use:

  • To add responsibilities to objects dynamically and transparently

  • When extension by subclassing is impractical

Prompt Example:

"Verwende das GoF-Decorator Pattern, um dem Logger dynamisch Formatierung, Timestamp und Filterung hinzuzufügen."