3 ms·
It's slightly more. Your code wouldn't create it's own ShippingGateway - it would be passed in (or "injected"). That Shipping Gateway could be a RealShippingG
by AndrewDucker 14y ago
It's slightly more.
Your code wouldn't create it's own ShippingGateway - it would be passed in (or "injected"). That Shipping Gateway could be a RealShippingGateway (for when the application is running in production) or a MockShippingGateway (for unit testing), or some other variant for when your test users don't want to actually ship things. It doesn't matter which of those it is to the object it's passed into, all it knows is that it has a ShippingGateway, and when/how to call it.
So it's Adapter Pattern + Interfaces together that matter.
- emehrkay 14y agoMakes sense. So basically this is DI for adapters/gateways?
- AndrewDucker 14y agoThat's my understanding. But I'm not 100% I haven't missed some subtlety.