Add push, change nothing
transcript
Product wants a push channel next month. In most code, you edit the service that sends the message. Here, you edit nothing.
The service builds its own channel, with an if. It names every concrete class. An else if for SMS. An error for anything else. Push means another else if, inside order logic that was working fine.
Move the choice into one table. Each name has its constructor. The service gets the registry, and asks by name. It never names a concrete class. A config setting supplies the name.
One new class for push. One new line in the registry. And zero lines edited in the service.
A test hands the service a registry whose entries build fakes. Nothing real is sent. The ladder offered no way to do that.
The choice lives in one table. A typo can be caught at start up. A new channel is one class and one line.
Full breakdown in the lecture.