News for hackers. Stuff that matters.
Re:You probably don't need a dependency injection framework by kazinator on Sunday May 25, 2025 @11:36AM (#44088581)
It's not just about testing. When any code constructs its own object, and that object is actually an abstraction of which we have many implementations, that code becomes stupidly inflexible.

For instance, some code which prints stuff, but doesn't take the output stream as a parameter, instead hard-coding to a standard output stream.

That leaves fewer options for testing also, as a secondary problem.

Re:You probably don't need a dependency injection framework by layer8 on Sunday May 25, 2025 @06:02PM (#44091611)
That’s just parameterization, though. It’s overkill to call every parameter (or even most parameters) a “dependency”.
Re:You probably don't need a dependency injection framework by kazinator on Monday May 26, 2025 @02:10PM (#44099993)
So even "dependency parametrization" would be better than "injection".

Since what we want to parametrize are objects held by composition, maybe "composition parametrization".

"To promote better flexibility and code reuse and to make testing easier, parametrize object composition."