Hacker News new | ask | show | jobs
by quotemstr 4426 days ago
Dependency injection is an abomination. Working on DI code feels like slogging through the post-processed expansion of some more elegant language. It's hard to understand control flow, and DI adds exciting failure modes to otherwise-correct code. Don't forget that DI also bloats class and method counts.

Substitution for testability should be done at the runtime level, substituting class references as needed, instead of punishing all production code everywhere.

1 comments

> Substitution for testability should be done at the runtime level, substituting class references as needed

That would require a Java agent. And that's a smell it its own right. (Cf JMockit)