1.3.6. Decorator vs Proxy
From the book:
Decorator is most similar in structure to proxy. Component
is like Subject
, Decorator
is like Proxy
, and ConcreteComponent
is like RealSubject
. One difference is in the classes that the client typically sees. In the proxy, the client uses the interface of the Subject
, whereas in decorator, the client may use the concrete decorator instances. Another difference is that a decorator normally has a component as constructor parameter.
0 comments