Functions | |
def | Proxy_Exercise () |
Example of using the Proxy Pattern. | |
def Proxy_Exercise | ( | void | ) |
Example of using the Proxy Pattern.
The Proxy pattern is used when a large or expensive object cannot be represented directly in the program, typically because the object is in another process or even another system altogether.
In this exercise, a Proxy class implements the same interface as the Real class, making the Proxy class look like the Real class. Calls made on the Proxy class are passed to the Real class where the work is actually done (in this case, a munged string with the text "Real class received 'xxxx'".
The only difference in output here is one additional line for the first call showing the real class being instantiated. The subsequent calls do not show this line.
Definition at line 26 of file proxy_exercise.py.