Design Patterns - Proxy Pattern
There are many different flavours of Proxy, depending on it's purpose. You may have a protection proxy, to control access rights to an object. A virtual proxy handles the case where an object might be expensive to create, and a remote proxy controls access to a remote object.
This pattern is recommended when either of the following scenarios occur in your application:
- The object being represented is external to the system.
- Objects need to be created on demand.
- Access control for the original object is required
- Added functionality is required when an object is accessed.
@reference_2_dzone.com
Proxy Pattern Tutorial with Java Examples
If you've read my "Decorate Your Java Code" (JavaWorld, December 2001), you may see similarities between the Decorator and Proxy design patterns. Both patterns use a proxy that forwards method calls to another object, known as the real subject. The difference is that, with the Proxy pattern, the relationship between a proxy and the real subject is typically set at compile time, whereas decorators can be recursively constructed at runtime.
@reference_3_javaworld
Java Design Patterns
If you've read my "Decorate Your Java Code" (JavaWorld, December 2001), you may see similarities between the Decorator and Proxy design patterns. Both patterns use a proxy that forwards method calls to another object, known as the real subject. The difference is that, with the Proxy pattern, the relationship between a proxy and the real subject is typically set at compile time, whereas decorators can be recursively constructed at runtime.
@reference_3_javaworld
Java Design Patterns
No comments:
Post a Comment