Proxy Design pattern

Proxy design pattern is one of the simplest design pattern. The name explains it all, we place a proxy class between the client and actual implementation. An example is EJB’s home and remote interface implementation. Or think of a webservice call, where we are trying to fetch Employee details from webservice. Instead of calling the webservice directly we bring in a proxy class, which is called by client and it call’s the actual webservice later. The advantage it gives us is that if the webservice call changes, say url for the call changes or pattern of input/ output xml is modifies, we just need to make change at one place, rather than changing calls at multiple clients.


2 Responses to Proxy Design pattern

  1. manoj says:

    Proxy Design Pattern in Java, lazy loading using Proxy Design Pattern

    What is Proxy Design Pattern

    1. Proxy design patten works on the principal of exposing an Java Instance through a proxy instead of actual object.

    2. Client would never know anything about actual object and through Proxy only relevant behavior of actual object will be exposed to client.

    3. Proxy Pattern can be used for applying security on actual Object. Service provider does not want actual class to be visible to any client Instead It would be shared as per Client contract agreement . Service provider may agree to share only a part of Service with it’s client and for that It may expose a different contract in the form of interface in java .

    4. This concept is very useful for lazily loading an instance . Data will be loaded only when it is actually required in an operation .

    Learn more about proxy design pattern here — Proxy Design Pattern

  2. admin says:

    Thanks for the inputs Manoj

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>