The Proxy pattern is a structural GoF design pattern by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides that provides a surrogate or placeholder for another object to control access to it. The proxy offers a more versatile reference than a simple pointer and comes in remote, virtual, protection and smart reference variants, for example a caching proxy that answers repeated API requests from its cache.

GoF-Proxy Pattern

Details
Full Name

GoF Proxy Pattern (Structural)

Intent:

Provide a surrogate or placeholder for another object to control access to it.

When to Use:

  • When you need a more versatile or sophisticated reference to an object than a simple pointer (remote, virtual, protection, or smart reference proxy)

Prompt Example:

"Implementiere einen Caching-Proxy nach GoF für den API-Client, der wiederholte Anfragen aus dem Cache beantwortet."