Author image

Proxy Design Pattern


What is a proxy? Dictionary says “The authority to represent someone else”. hmmm… Ponder on that a bit and let's see how the “Name and Conquer” of Proxy applies to software design patterns.

The definition of the Proxy pattern goes like this:

Provides a surrogate or placeholder for another object in order to control access to it.

Let's get the obvious stuff out of the way:

  1. A proxy certainly provides another level of indirection to another “target” object that we basically want to access

That's it. I have nothing else that seems obvious from the definition alone. But after further investigation and coding I realize that a Proxy object is indeed useful when we want to lazy-instantiate an object, or when we want to hide the implementation details of the object. For whatever reason, but this often comes up in software, we represent a back-end highly complicated object with a more...

1