Frequently asked questions
Q1. What is the difference between the Decorator pattern and Proxy pattern?
A: A Decorator adds behavior to the object that it decorates at runtime, while a Proxy controls access to an object. The relationship between Proxy and RealSubject is at compile time and not dynamic.
Q2. What are the disadvantages of the Proxy pattern?
A: The Proxy pattern can increase the response time. For instance, if the Proxy is not well-architectured or has some performance issues, it can add to the response time of RealSubject. Generally, it all depends on how well a Proxy is written.
Q3. Can the client access RealSubject independently?
A: Yes, but there are certain advantages that Proxies provide such as virtual, remote, and others, so it's ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access