Structural

Proxy

Description

Lets you provide a substitute or placeholder for another object. A proxy controls access to the original object.

Where to use

  • Lazy initialization (Virtual Proxy).
  • \n
  • Access Control (Protection Proxy).

Real World Example

A website displays a low-res placeholder image while the high-res image downloads in the background.

Code Example

class Proxy:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Proxy')