Re: Singleton question (shared class)

2012-01-26 Thread Ali Çehreli
On 01/25/2012 06:35 AM, Mars wrote: I have a few classes which I want to implement as singletons (like configuration, database connection, etc.), because I have to access them throughout my whole program, and from different threads. You haven't asked, so I shouldn't be commenting on your

Re: Singleton question (shared class)

2012-01-26 Thread Mars
On Thursday, 26 January 2012 at 19:13:11 UTC, Ali Çehreli wrote: You haven't asked, so I shouldn't be commenting on your design, but singleton is accepted as an anti-pattern for a long time now. It is more like a solution in search of a problem. For example, in your case, you can solve your

Singleton question (shared class)

2012-01-25 Thread Mars
Hello everybody. I have a few classes which I want to implement as singletons (like configuration, database connection, etc.), because I have to access them throughout my whole program, and from different threads. I'm implementing the singletons like this:

Re: Singleton question (shared class)

2012-01-25 Thread Mars
Alternative approach, I just found: http://pastie.org/private/1jlcvfostnbopfp3quflg If I get that right, this is basically the classic singleton, like it would be in other languages, right? So... what's the best way? Mars

Re: Singleton question (shared class)

2012-01-25 Thread Steven Schveighoffer
On Wed, 25 Jan 2012 09:50:57 -0500, Mars -@-.- wrote: Alternative approach, I just found: http://pastie.org/private/1jlcvfostnbopfp3quflg If I get that right, this is basically the classic singleton, like it would be in other languages, right? So... what's the best way? This is an ok

Re: Singleton question (shared class)

2012-01-25 Thread Andrew Wiley
On Wed, Jan 25, 2012 at 9:35 AM, Steven Schveighoffer schvei...@yahoo.com wrote: On Wed, 25 Jan 2012 09:50:57 -0500, Mars -@-.- wrote: Alternative approach, I just found: http://pastie.org/private/1jlcvfostnbopfp3quflg If I get that right, this is basically the classic singleton, like it