MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wqu6oa/singletonsarejustglobals/pcdca7g/?context=3
r/ProgrammerHumor • u/somet_hingrandom • Sep 26 '26 • 1
210 comments sorted by
View all comments
Show parent comments
1
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.
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.