Abstract Factory

Abstract Factory: build FAMILIES of related objects

Problem: you need a matched set of objects that must be used together β€” mixing them would be a bug.

PawWalk scenario: for payments you need a charger AND a refunder that belong to the same provider. Stripe's charger with PayPal's refunder is nonsense. An abstract factory hands you a coherent pair.

In Ruby the 'factory' is often just a method returning a small object (a Struct or OpenStruct) that exposes the related methods.