Re:Singleton Is a Bad Idea
by Matthias247 on Sunday April 10, 2022 @02:02PM
(#30979790)
I guess so. My favorite problem with singletons is testability. How can you properly mock/observe/etc it inside a test case, if lots of test-cases are executed in parallel. With a real global object it can be tricky. But if the object is not global because an IOC container might still create a fresh one per test, it wouldn't be an issue.
[ Parent
| on HN ]
There are no comments on this comment yet.