1

Possible Duplicate:
What is so bad about Singletons?

One of the drawbacks of using Singleton, as widely discussed in this stackoverflow question is that they hide the class dependencies in the code. However, we can make a singleton implement an interface while still obeying the two rules of singleton: single instance and global scope.
Why is Singleton still said to hide dependencies?

4

1 に答える 1

0

依存関係を非表示にするということは、シングルトンはどこからでも呼び出すことができるため、コードからシングルトンへの目に見えるリンクがないことを意味します。インターフェイスを実装するシングルトンを使用しても、問題は変わりません。

于 2012-05-09T07:49:08.417 に答える