Proxy Pattern

The Proxy pattern provides a surrogate or placeholder object to control access to the original object. There are several types of implementations of the Proxy pattern, with the Remote proxy and Virtual proxy being the most common. 

UML representation


The following lists the benefits of using the Proxy pattern:
  • A remote proxy can hide the fact that an object resides in a different address space.
  • A virtual proxy can perform optimizations, such as creating an object on demand.

When to Use

You should use the Proxy pattern when:
  • You need a more versatile or sophisticated reference to an object than a simple pointer.
Subpages (1): Proxy Pattern Example