Common Structural Patterns - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. Suppose you want to add responsibilities to an object. Which of the following patterns allows you to do that?
Please select the best answer.
  A. Adapter
  B. Bridge
  C. Composite
  D. Decorator
  The correct answrer is D. This is the definition of the Decorator pattern.

2. Which of the following patterns controls access to an object by standing in for the object while providing the same interface?
Please select the best answer.
  A. Adapter
  B. Proxy
  C. Composite
  D. Decorator
  The correct answer is B.
The Proxy pattern is very close to the Adapter pattern. Both Adapter and Proxy use a surrogate object that passes method invocations to the original object. However, the Adapter provides a different interface.
The Proxy provides the same interface.

3. Suppose you want to provide a single, unified interface to a subsystem comprised of several interfaces.
Which of the following patterns allows you to do that?
Please select the best answer.
  A. Adapter
  B. Bridge
  C. Façade
  D. Decorator
  The correct answer is C.
The Façade pattern provides a single unified interface for a sub-system of many different classes and objects.