© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
George
Programming with passion.
Singletons are horrible advice, don't follow that pattern. Anything that creates a static, package level variable is bad.
Andrey Panin
Care to elaborate on that?
Andrey Panin misko.hevery.com/code-reviewers-guide/flaw-brittl…
Sayed Alesawy
Lead Software Engineer @ Instabug
I know there is a somewhat compelling argument against singleton in general. I am not sure how could I replace it tho and get the same effect? I will check the article you mentioned. Thanks for the comment!
Sayed Alesawy Replace it with a regular struct which accepts the dependency on it.
If it gets complex you can write a factory method on the struct.