5 ms·
What's a less abstract name for dependency injection?
by ShaneWilton 9y ago
What's a less abstract name for dependency injection?
- hamilyon2 9y agoBetter boilerplate code constructing things.
- tuukkah 9y agoThat's not a name and it's not a good name. Naming is hard: you need a succint yet descriptive and specific phrase. "Dependency injection" nicely evokes the issue of your code depending on other code and how you can avoid hardcoding dependencies by injecting a reference to them at start of execution.
- deleted 9y ago[deleted]
- itronitron 9y agoConstructors With Arguments would be my suggestion
- ShaneWilton 9y agoThe main point of dependency injection isn't that you're passing collaborators into the constructor though -- that's just an implementation detail. It's about achieving inversion of control, and using a constructor to inject dependencies is just one example of how to do that. There's also setter based DI, and interface based injection, but again, those are just implementation details.