Dependency Injection (DI) a chiallaíonn go bhfaigheann réad a dhíoltachuithe ó thaobh amuigh seachas iad a chruthú féin. Cineál de Inversion of Control (IoC) a bhíonn ann: tá an fhreagracht ar chóiriú oibiachtanna inbhéartaithe ó thaobh an oibiacht agus tugtha d'iarratasóir nó do choimeádán.
Gan DI vs. le DI
:
():
.repo = PostgresOrderRepo()
:
():
.repo = repo
service = OrderService(PostgresOrderRepo())
test = OrderService(InMemoryOrderRepo())
