Applied Design Patterns with Java
Structural :: Proxy (207) {C ch 15}
Implementation
Here are implementation issues to consider when using the Proxy pattern:
Related Patterns
Adapter (139) provides a different interface to the object it adapts. In contrast, a Proxy
provides the same interface as its subject. However, a Proxy used for access protection might refuse to perform an operation
that the subject will perform, so its interface may be effectively a subset of the subject's.
Decorator (175): Although Decorators can have similar implementations as Proxies, Decorators
have a different purpose. A Decorator adds one or more responsibilities to an object, whereas a Proxy
controls access to an object.
Proxies vary in the degree to which they are implemented like a Decorator. A protection proxy
might be implemented exactly like a Decorator. A remote
proxy will not contain a direct reference to its
real subject but only an indirect reference, such as "host ID and local address on host." A virtual proxy
will start off with an indirect reference such as a file name but will eventually obtain and use a direct reference.