Original Post
Seems like a lot of people hate singletons. I think that "pattern" in particular is too easy to abuse, like many things, but that it definitely has a place in software engineering. Especially in game development. You can''t decouple everything. Even if I agree to the idea that a singleton is sometimes just a glorified global variable, what''s a better way to model that coupling?
To provide a more concrete question, say I''m designing a portable game engine that will work on PC, PS2, and Xbox.
There will be several subsystems: input, graphics, sound, storage, etc.
There will be several different implementations of those subsystems, but the interfaces themselves should be accessible wherever they are needed in the simplest possible way.
There''s singleton. Then there''s having pointers to interfaces in classes that need to use those interfaces. Then there''s passing a pointer to the interface as function parameters. Seems like the singleton is the simplest, most efficient, and easiest to maintain- what''s not to like?
What am I missing?