Extract Interface
Domain: Refactoring
π― Motivation
When multiple classes share behavior but no common parent, extracting an interface formalizes the contract. This enables polymorphism and easier testing through fakes or mocks.
π Concrete Example
CreditCardProcessor and PayPalProcessor both have charge(amount). Extract an IPaymentProcessor interface so Checkout can accept either, and tests inject a FakeProcessor.
π Analogy
Different phone brands agree on what a βcharger portβ means even though their phones differ. The standard interface lets any charger work with any compatible phone.