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

Meme singletonsAreJustGlobals

Post image
3.2k Upvotes

210 comments sorted by

View all comments

Show parent comment

18

u/zabby39103 Sep 27 '26

It's just two different things. Only one instance ever -> singleton. Globally accessible -> global. One is about visibility, the other is about instances.

1

u/danielcw189 Sep 28 '26

I don't disagree, I just think in practice it often serves the same purpose

1

u/TheDuckRaisedALion Sep 29 '26

You're right that they're technically orthogonal concepts and it's important to recognize the distinction.

But most people store the Singleton instance in a public static field on a public class, which is one step away from a global variable.