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.

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.