GoF-Command Pattern

Details
Full Name

GoF Command Pattern (Behavioral)

Intent:

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.

When to Use:

  • When you want to parameterize objects with an action to perform

  • When you need undo/redo functionality

  • When you need to queue, log, or schedule requests

Prompt Example:

"Implementiere ein Undo/Redo-System nach dem GoF-Command Pattern, bei dem jede Benutzeraktion als Command-Objekt gekapselt wird."