Singleton pattern in D

janderson askme at me.com
Sat May 12 03:12:46 PDT 2007


janderson wrote:
 > David Ferenczi wrote:
 >  >> Final point: just make sure you actually need singleton.  I've seen a
 >  >> lot of people using singleton for a single class, which would be more
 >  >> efficiently handled by a static class.
 >  >
 >  > Can you mention some godd and bad examples?
 >  >
 >
 > 9) Perfect is the enemy of good.  Don't over design.  Get the 
fundamentals and then add as needed.
 > Particularly if your writing code that is application code or 
internal to a library (with public libraries
 > you don't know what your users will need).

That should be:
... Particularly if your writing code that is application code or 
internal to a library. This approach of course doesn't not work for 
public library interfaces where the more flexibility provided the better.

Now I only wish I could always follow my own advice ;)

-Joel


More information about the Digitalmars-d-learn mailing list