Remote Proxies
The idea of a proxy is that one object intelligently forwards calls to another object. This can become complex and fragile, as in the case of ImageIcon, where it is difficult to know which calls to forward. Even if you forward every call, your code may break if the class of the proxied object changes. When you encounter the PROXY pattern in a design, you should question whether the benefit justifies the accompanying fragility of code. There are cases in which applying PROXY is well justified, as when an object and its proxy are active on different computers.
If the object whose method you want to call is running on another computer, you must find a way to communicate with the remote object other than calling it directly. You could ...
Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.