Presentation is loading. Please wait.

Presentation is loading. Please wait.

Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar.

Similar presentations


Presentation on theme: "Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar."— Presentation transcript:

1 Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar to a pointer) Provides a public interface to the real object

2 Proxy Services Local interface Access control
Resource instantiation cost reduction

3 Types of Proxies Protection Proxies grant or deny client access to the real subject (i.e., check permissions) Remote Proxies are a local representation of a real subject in a different host (e.g., RMI) Virtual Proxies represent expensive objects, such as images (e.g., replies to getHeight()) Smart Reference Proxies can count number of times referenced, act as lock or semaphore

4 Proxy UML Representation
Request () ...() Subject Proxy Client RealSubject realSubject Abstract Class Generalization Aggregation Interaction

5 Code Example private void init() { imgProxy = new ImageProxy (); }
//Do stuff to image public ImageManipulation1() { InitializeComponent(); init(); //Then instantiate image private initiate(object, args) { Real.Image = imgProxy.getImage ();


Download ppt "Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar."

Similar presentations


Ads by Google