Singletons Are Evil

http://c2.com/cgi/wiki?SingletonsAreEvil

Almost every use of singleton I have encountered was best replaced by an attribute accessor in a higher level object that is then either

  • explicitly passed around via a parameter, or
  • used via a dynamically bound variable (possibly within a thread-safe wrapper)

你可能感兴趣的:(thread,cgi)