Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

IoC isn't even DI. IoC is saying "I need to talk to a service that handles these account operations I care about" rather than "I need a MySql connection, a coupla s3 buckets and a folder on disk"

DI can support both the "I need" and "I orchistrate" patterns.

Obviously modulo leaky abstractions! You might want to known if that account code is in L1 cache or Timbuktu.



So is DI usually referring to automatic framework-wiring DI? Cause I constantly pass dependencies in as arguments and call it DI.


DI can be manual DI - passing dependencies. I think the hallmark is lack of "new" in your classes (or probably lack of specific imports in a non OO idiomatic language like JS)

IoC is more about design than dependency resolution mechanisms.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: