Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Outline
layout title folder permalink pumlid categories tags
pattern
Proxy
proxy
/patterns/proxy/
9SR13OCm30NGLM00udktCS62eCI9x6yesrEfx_Jcehd69c5rEe3X7oBZE-q5HwpXOhahH95oRrHgt0msEldYPHClkow30J5rQko_qB3-VKYG_qjXBOrezGK0
Structural
Java
Gang Of Four
Difficulty-Beginner

Also known as

Surrogate

Intent

Provide a surrogate or placeholder for another object to control access to it.

alt text

Applicability

Proxy is applicable whenever there is a need for a more versatile or sophisticated reference to an object than a simple pointer. Here are several common situations in which the Proxy pattern is applicable

  • Remote proxy provides a local representative for an object in a different address space.
  • Virtual proxy creates expensive objects on demand.
  • Protection proxy controls access to the original object. Protection proxies are useful when objects should have different access rights.

Typical Use Case

  • Control access to another object
  • Lazy initialization
  • Implement logging
  • Facilitate network connection
  • Count references to an object

Real world examples

Credits

Morty Proxy This is a proxified and sanitized view of the page, visit original site.