The Proxy pattern provides a surrogate or placeholder object to control access to the original object.
There are several types of implementations of the Proxy pattern with the
- Remote proxy and
- Virtual proxy
being the most common.
The figure below illustrates the Proxy pattern.
You are currently designing your own Desktop Publishing application, as you have not found any that do exactly what you want with existing applications.
As part of the design you are using a Controller to which you send all GUI requests.
Not all objects can process the same commands.
For example you cannot select the spell check tool when an image has the focus.
To stop any possible errors you would like to filter out some of the messages as they are passed from these objects to the Controller object. What pattern could you use?
In this scenario what you are essentially trying to do is filter all packets that don't meet a certain set of requirements.
This behavior is just like a Proxy server dropping packets from certain IP address etc.