News for hackers. Stuff that matters.
Re:You probably don't need a dependency injection framework by bluGill on Sunday May 25, 2025 @08:05PM (#44092513)
many of the things I dependeon are shared services where there should only be one instance. Singleton means a global variable. a di framework lets me have on without a global - meaning if I need a second service I can do it with just a change to how the di works.

there is no right answer of course. Time should be a global so that all timers/clocks advance in lock step. I hav a complex fake time system that allows my tests to advance minutes at a time without waiting on the wall clock. (If you deal with relativity this may not work - for everyone else I encourage it)

There are no comments on this comment yet.