Proxy Design Pattern
Learn about the proxy pattern, its purpose, applicability, and structure, as well as related design patterns.
We'll cover the following...
Overview
Suppose that we have a very sensitive object, and we don’t want the client to access it directly. Or, we have an object that is very expensive to create. We certainly want to limit access to the objects in these cases. This is where we would use the proxy pattern.
In the proxy pattern, we introduce a middleman (surrogate) that will interact with the real object. Through this proxy (surrogate), we can limit access to the original object. It will also help us hide the detail of the real objects from the client.