⊗
Welded
⇅
Inverted
OrderService welded to a concrete EmailSender
OrderService
high-level policy
new EmailSender()
«interface»
MessageSender
+ send(to, text)
EmailSender
low-level detail
Tray · plug an implementation into the socket
Swap the sender without touching
OrderService
?
✗
No
Unit-test
OrderService
with a fake?
✗
No
—
—
▸
Depend on the
socket
(the interface), not the
plant
(a concrete class). Flip to
Inverted
and plug things in —
OrderService never changes
.