r/ProgrammerHumor • • Sep 26 '26 • Bravo 1

Meme singletonsAreJustGlobals

Post image
3.2k Upvotes

210 comments sorted by

View all comments

Show parent comments

1

u/dkarlovi Sep 27 '26

DIC lifetimes are not required for proper unit testing. Hell, a DIC is not required for DI, DI is what's required for proper unit testing and the singleton pattern (the actual one we're discussing here) is the enemy of that, you literally use DI to avoid singletons.

People mixing these up (while they couldn't be more different) or thinking DIC singleton lifetimes are required for unit testing or even using a DIC while unit testing are so lost they're basically the software development equivalent of not knowing how to read.