CodePark/ questions / Structural patterns
START PRACTICINGPRACTICE
Backend question · Software design & patterns › Structural patterns

Your domain defines interface SmsSender { send(to: PhoneNumber, text: string): Promise<void> }. You write TwilioSmsSender, which implements it by calling the Twilio SDK with its own method names and payload shape. Which pattern is this?

Adapter

This is an adapter. It makes an existing interface (the Twilio SDK) fit the interface that the client expects (SmsSender). "Facade" is the tempting wrong answer. A facade also puts a new interface over a subsystem, but its goal is to make things simpler. Its goal is not to match an interface that the client already defined.