Original Post
I''ve found myself using Monostates much more commonly recently, rather than the apparently more popular Singleton pattern. I''ve used Singletons in the past and found them to be overly elaborate for what they achieve.
Off the bat, I''d like to say that I think single-instance classes are overused in modern game programming (at least at the amatuer level). I can imagine only a handful of subsystems that might truly need to utilize one such pattern, including: a global debugging system, resource management (spec. precaching), and message passing between subsystems.
My question is this (and I''m assuming that you''re familiar with both patterns to a conversant degree; if not, please refrain from response): Are monostates not (1) more elegant, (2) less complex, (3) more efficient, and (4) less error-prone, in the same contexts as one might use a Singleton?
I ask because, as I said, Singletons have been promoted wildly by the likes of Meyers, the GOF, and even Alandrescu (sp?), while virtually no emphasis has been placed on Monostates. I find them to be pretty functional in most circumstances, due to the fact that single-instance and single-state just seem to go hand-in-hand.
Am I overlooking something? Discuss.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
miscellaneous links