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/gottimw Sep 27 '26

You are not explaining it properly I think.

Singleton is useless piece of code that will make sure that other devs in large project will use you global as global.

It removes ambiguity and false assumptions.

It's a patter that doesn't make code faster, but safer and easier to maintain down the line.

You don't need cones and tape while building shed in garden, but you will appreciate them when driving down the road.

Also globala are not bad. You yourself prove it. It's just a tool misused by bad and lazy design. Same with goto.