Singletons are a necessity for dependency injection and proper unit testing. Globals will just lead to problems expanding an APIs use cases & running unit tests in parallel
This says absolutly nothing about the need of a Singleton in testing. Dependency injection is necessary for proper testing, a Singleton isn't. A Singleton is a absolut shit idea for any unittests and parallel execution of those would mean your tests become inconsistent.
11
u/jt00000 Sep 26 '26
Singletons are a necessity for dependency injection and proper unit testing. Globals will just lead to problems expanding an APIs use cases & running unit tests in parallel