Multiple choice technology architecture

What is a Decorator pattern?

  1. decouple an abstraction from its implementation so that the two can vary independently

  2. One class takes in another class, both of which extend the same abstract class, and adds functionality.

  3. Assembles group of objects with same signature

  4. One class controls the creation of and access to objects in another class.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Decorator pattern attaches additional responsibilities to an object dynamically. It wraps a component (both implement the same interface) to add behavior without modifying the original class. Option A describes Bridge pattern (decoupling abstraction from implementation), Option C describes Composite pattern (tree structures of objects), and Option D describes Facade pattern (simplified interface to a complex subsystem).