문제

Possible Duplicates:
What is so bad about Singletons
Problems with Singleton Pattern

Are there any downsides to the singleton pattern? I heard this was an interview question and i am coming up short on what was meant.

imho, it's about the usage and nothing in the pattern itself is problematic

도움이 되었습니까?

해결책

From Wikipedia:

Some consider it an anti-pattern, judging that it is overused, introduces unnecessary limitations in situations where a sole instance of a class is not actually required, and introduces global state into an application.

Personally, since I've started using Spring to auto-wire my application I've never had the need to write a singleton.

다른 팁

최저치를 설정하면 Parsefloat를 시도하십시오.

var minimumPercent = ParseFloat($('.donationTextBox').val());
.

엔진이 문자열을 플로트로 비교하면서 Float을 문자열로 변환하고 100.00 <2.50= true 왼쪽에서 오른쪽 알파벳순 비교로 true를 변경합니다.

마이크

  1. Not testable or at least it's difficult
  2. Hard to find dependent classes
  3. Does not allow subclassing
  4. ...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top