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)

相关文章:

  • 2021-12-25
  • 2021-09-22
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-04
  • 2022-12-23
  • 2021-06-26
  • 2022-02-26
  • 2022-01-30
  • 2021-09-07
  • 2022-02-06
相关资源
相似解决方案