Structural Patterns: Proxy

The Proxy pattern supports objects that control the creation of and access to other objects. The proxy is often a small (public) object that stands in for a more complex (private) object that is activated once certain circumstances are clear.

UML Diagram-

Proxy Design Pattern

Proxy Design Pattern


Kind of Proxies and there features-
There are several kinds of proxies, the most common of which are:
Virtual proxies- Hands the creation of an object over to another object (useful if the creation process might be slow or might prove unnecessary)
Authentication proxies- Checks that the access permissions for a request are correct
Remote proxies- Encodes requests and send them across a network
Smart proxies- Adds to or change requests before sending them on

With regard to a social networking system, these map as follows:
â?¢ Delaying the creation of a rich environment (virtual proxy)
â?¢ Logging in users (authentication proxy)
â?¢ Sending requests across the network (remote proxy)
â?¢ Performing actions on friendsâ?? books (smart proxy)

Use of Proxy pattern-
Proxies are front-ends to classes that have sensitive data or slow operations. They are often found in image-drawing systems, where the proxy places a placeholder on the screen and then activates a real drawer to fetch and render the image. In the same way, they can be involved in initiating the buffering associated with video streaming.
Proxies, like decorators, forward requests on to another object. The difference is that the proxy relationship is set up at design time and is well-known in advance, even though the Subject is not an active participator in the relationship. Decorators, on the other hand, can be added dynamically.

Use the Proxy pattern when you have objects that-
â?¢ Are expensive to create.
â?¢ Need access control.
â?¢ Access remote sites.
â?¢ Need to perform some action whenever they are accessed.
Use the Proxy pattern when you want to-
â?¢ Create objects only when their operations are requested.
â?¢ Perform checks or housekeeping on objects whenever accessed.
â?¢ Have a local object that will refer to a remote object.
â?¢ Implement access rights on objects as their operations are requested.

5 Responses to Structural Patterns: Proxy

  1. Can you tell me how I can add your weblog to my news reader. your help are appreciated I want to access your articles.

  2. LenHewitt says:

    INteresting informations, thanks for sharing

  3. Hello guys, wonderful web page, particularly rich in content and appropriately carefully thought out, personally I found here substantially interesting and useful

  4. I do consider all the ideas you have presented to your post. They’re very convincing and can definitely work. Still, the posts are very short for starters. May you please extend them a bit from next time? Thanks for the post.

  5. Valuable information. Lucky me I discovered your web site unintentionally, and I am shocked why this coincidence did not took place in advance! I bookmarked it.

Leave a Reply