Jon Stewart on 18 Jun 2003 21:32:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ALACPP] Singleton clarification


> "singletons present themselves all the time" always scares me. I tend to
> think more in terms of "opportunities to abuse the singleton pattern
> present themselves all the time". ;-) But hey, that's just me.


I dunno'. I tend to prefer that all my methods simply have void arguments,
and use singletons to get at non-member data. 

 ...

log4cpp mis-uses the singleton pattern, to great effect (they're leaky). I 
think their system would be better served if they had simple category 
objects that had normal value semantics. Nevertheless, one of its key 
features is the configuration file, which can determine at run-time which 
log statements, well, log, and which don't. In that case, your simplified 
category objects still need to consult a central authority; that seems to 
me like a good example of when to use a singleton.

You can always get around using a singleton, but it can become a bit of 
pain.



Jon
-- 
Jon Stewart
stew1@xxxxxxxxxxx
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp