Design Patterns · Middle · Question 16 of 75
Notifications come in three types and are sent over three channels (email, push, SMS). Which pattern saves you from 9 classes?
- ✓Correct answer: Bridge: the notification type and delivery channel evolve independently
- 2Singleton: all notifications are sent through one instance
- 3Iterator: channels are iterated in turn for each type
Explanation
Bridge separates the abstraction (notification type) from the implementation (channel) and links them via composition: 3 + 3 classes instead of 3 × 3. A new channel is added without changing the types.