Collected Readings on Singletons

Published May 25, 2007
Advertisement
I was originally going to write something myself. I decided it wasn't necessary; Washu, jpetrie, and others did most of the actual work already. This list will be updated whenever I feel like it. The ones I like are in bold.

Washu's Journal
Why are you infected with Singletonitis?
Singletonitis, Part 2
Singletonitis, Part 3
Threads
Singletons and Memory Management
When to use and not to use singletons
Rate my engine!
learning singletons
Sharing data between game states
Good/Generic C++ Programming
Singleton managers
Singleton versus Monostate Pattern
The One: A Singleton Discussion (companion to article)
A Singleton Texture Manager for OpenGL (companion to article)
Articles
A Singleton Texture Manager for OpenGL
The One: A Singleton Discussion
Using Managers
The Singleton Class Cluster
External Links
Singleton Pattern (wikipedia)
Singleton Pattern (c2 wiki)
Singleton Considered Stupid
Use your singletons wisely
Why Singletons are Evil
Singletonitis
0 likes 4 comments

Comments

Oluseyi
I think you could replace all of that with "Don't use Singletons. Ever. Seriously. Like, use a Monostate or something else. Dude, I'm not kidding. It's just an 'object-oriented' global."
May 25, 2007 09:50 AM
Ravuya
The thing is, they push singletons in university CS "software engineering" classes. I've had arguments of several minutes with my professors about whether or not it's appropriate to use a singleton, myself arguing that it perverts proper application flow and hampers readability (as well as breaking flexibility) and them arguing that they're lazy.

Academics...
May 25, 2007 09:55 AM
jollyjeffers
Nice one for collecting all those links together. Shall have to remember this link for the inevitable future discussion [smile]

I find that design pattern usage is in one of two extremes - over use or under use, never "just right." People religiously sticking to a pattern are just an example of those with tunnel vision that over-use something and try desperately hard to distort the world to fit that one tool...
May 25, 2007 02:08 PM
Ahnfelt
My sarcasm detector might not be working, but I disagree that a monostate is any better than a singleton. Both are globals in disguise (though monostates are very well disguised... which might even be a problem of it's own).

Global mutable state is the major issue I think, since it introduces implicit dependencies between modules that use the state. You may call it a singleton, a monostate or a static variable, but they all suffer from the same problem. The solution is simple: avoid it as much as possible.
July 30, 2008 01:45 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement