  in computer programming, the proxy pattern is a software design pattern. a proxy, in its most general form, is a class functioning as an interface to something else. the proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. a well-known example of the proxy pattern is a reference counting pointer object. in situations where multiple copies of a complex object must exist, the proxy pattern can be adapted to incorporate the flyweight pattern in order to reduce the application's memory footprint. typically, one instance of the complex object and multiple proxy objects are created, all of which contain a reference to the single original complex object. any operations performed on the proxies are forwarded to the original object. once all instances of the proxy are out of scope, the complex object's memory may be deallocated. == usage == the proxy design pattern allows you to provide an interface to other objects by creating a wrapper class as the proxy. the wrapper class, which is the proxy, can add additional functionality to the object of interest without changing the object's code. below are some of the common examples in which the proxy pattern is used, *adding security access to an existing object. the proxy will determine if the client can access the object of interest. *simplifying the api of complex objects. the proxy can provide a simple api so that the client code does not have to deal with the complexity of the object of interest. *providing interface for remote resources, such as web service or rest resources. *coordinating expensive operations on remote resources by asking the remote resources to start the operation as soon as possible before accessing the resources. *adding a thread-safe feature to an existing class without changing the existing class's code. in short, the proxy is the object that is being called by the client to access the real object behind the scene. == possible usage scenarios == remote proxy â represents an object locally which belongs to a different address space. think of an atm implementation, it will hold proxy objects for bank information that exists in the remote server. virtual proxy â in place of a complex or heavy object, use a skeleton representation. when an underlying image is huge in size, just represent it using a virtual proxy object and on demand load the real object. you feel that the real object is expensive in terms of instantiation and so without the real need we are not going to use the real object. until the need arises we will use the virtual proxy. protection proxy â are you working on an mnc? if so, we might 
Software_design_patterns