Repaso
Español
Design & PracticesIntermediateDP-12

You must use a third-party SMS client whose interface differs from your Notifier.send(to, text). Which pattern?

Options

  1. Adapter (Correct option)
  2. Facade
  3. Decorator
  4. Command

Answer

Adapter

Why

An Adapter is a small wrapper that converts one interface into the one your code expects, like a travel plug adapter.

Your SmsAdapter.send(to, text) internally calls the vendor's client.messages.create(dest=..., body=...).

The rest of your code keeps using Notifier.send and never knows the vendor's API.

Remember

Adapter = translate one interface into another.

Key terms

Practice this question in Repaso