Grokking Design Patterns for Engineers and Managers
0% completed
Bridge Pattern
The Bridge Pattern splits one class into two hierarchies that can vary independently, before they multiply into a class explosion.
Two things vary at once. You have three kinds of notification, an alert, a reminder and a digest, and three ways to deliver one, email, SMS and push. If both live in the same hierarchy, you need nine classes. Add a fourth channel and you need twelve. Add a fourth type as well and you need sixteen.
The giveaway is a class name with two nouns in it: EmailAlert, SmsDigest, PushReminder
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%