On Tue, Jul 21, 2009 at 1:52 PM, Marko Korhonen<[email protected]> wrote: > - Is there performance gain or memory savings or something like that?
On the contrary. A singleton prevents the garbage collector from functioning. > - Code syntax benefits? That's rather subjective. > - Something else? Low level of abstraction means easy to understand. This is the only benefit of a singleton. While it's real, it usually doesn't make up for the high level of coupling it incurs. Ultimately it's a judgement call, but most experienced programmers wouldn't use them in this scenario (or at all). > Only thing I really understand that it gets always the same instance of the > class > and does not create new ones. If you don't fully understand the implications of singletons, you should probably avoid them like the plague. If you *do* understand the implications of singletons you *will* avoid them like the plague. -- troels
