Mediator pattern 1. Distinguish between object behavior and coordinating behavio
ID: 3701317 • Letter: M
Question
Mediator pattern
1. Distinguish between object behavior and coordinating behavior.
Proxy pattern
1. Distinguish between the intentions of the Proxy and the Adapter patterns.
2. Distinguish between the intentions for Proxy and Decorator even though they are structurally similar.
3. Explain the use of Proxy for copy-on-write operations.
Decorator pattern
1. Contrast the added flexibility of the Decorator pattern using object structure to the way in which the intention of Decorator can be achieved using class structure.
2. Explain why the decorator and the concrete component must adhere to the same interface. Describe the mechanism for extending the interface of the concrete decorators.
3. Explain the problem with accessing extended functionality provided by all decorators in a chain.
4. Draw sequence diagrams for operations performed through chains of decorators.
5. Distinguish when Strategy vs. Decorator is the appropriate pattern to use.
Factory Method
1. Describe how the template mechanism of C++ can be used to avoid subclassing when using factory methods.
Explanation / Answer
1. Distinguish between the intentions of the Proxy and the Adapter patterns.
Answer:
Proxy:
proxy Could be used when you want to lazy-instantiate an object, or hide the fact that you're calling a remote service, or control access to the object.
Often proxies are one-to-one wrappers; one that actually represents data and a Proxy that add some behaviour to narrow behaviour, like lazy loading, some dynamic behaviour like transaction, security etc
adopter:
adopter Is also called "Smart Proxy." This is used when you want to add functionality to an object, but not by extending that object's type. This allows you to do so at runtime
differences:
->The primary purpose of the adapter pattern is to change the interface of class/library A to the expectations of client B. The typical implementation is a wrapper class or set of classes. The purpose is not to facilitate future interface changes, but current interface incompatibilities.
->
The proxy pattern also uses wrapper classes, but for a different purpose. The purpose of the proxy pattern is to create a stand-in for a real resource. Reasons for using a proxy can be
->Adapter pattern converts interface
->Proxy patterns also don't convert interface
->adopter
->proxy
->Proxy provide a surrogate or place holder for another object to control access to it.
->Adapter provides a different interface to its subject. Proxy provides the same interface
->Adapter is meant to change the interface of an existing objec