On design patterns: When should I use the singleton?

后端 未结 20 3501
失恋的感觉
失恋的感觉 2020-11-22 02:45

The glorified global variable - becomes a gloried global class. Some say breaking object-oriented design.

Give me scenarios, other than the good old logger where it

20条回答
  •  情书的邮戳
    2020-11-22 03:28

    As everyone has said, a shared resource - specifically something that cannot handle concurrent access.

    One specific example that I have seen, is a Lucene Search Index Writer.

提交回复
热议问题