News for hackers. Stuff that matters.
Re:You probably don't need a dependency injection framework by shadowgovt on Monday May 26, 2025 @12:22AM (#44093945)
In practice, we accomplish that by not monkeypatching the production code.

But for unit testing? Go nuts.

Re:You probably don't need a dependency injection framework by akoboldfrying on Monday May 26, 2025 @01:57AM (#44094393)
Sure, a policy like that helps, but relying on programmer discipline like this only scales so far. In a large enough code base, if something can be done, someone will have done it somewhere.

(If you have linter rules or static analysis that can detect monkeypatching and runs on every commit (or push to main, or whatever), you're good.)