The singleton design pattern in D, C++ and Java

Lutger lutger.blijdestijn at gmail.com
Mon Jul 26 14:30:58 PDT 2010


Nick Sabalausky wrote:

> "Jonathan M Davis" <jmdavisprog at gmail.com> wrote in message
> news:mailman.366.1279305632.24349.digitalmars-d at puremagic.com...
>>
>>Personally, I do use singleton from time-to-time and have found it quite
>>useful.
>>I wasn't aware that anyone thought that it was a bad idea.
>>
> 
> That was news to me too. My guess is that maybe there were a lot of people
> using it for things that may have *seemed* appropriate for a singleton but
> really weren't, like abstractions for the keyboard, mouse or screen/monitor.

More than that, singletons are often used as an 'object oriented' way of 
creating global variables, hence the bad reputation.

http://www.c2.com/cgi-bin/wiki?SingletonsAreEvil


More information about the Digitalmars-d mailing list