News for hackers. Stuff that matters.
Re:So Singletons are bad, then what? by arjie on Thursday January 30, 2014 @03:01PM (#7152993)
That's not what I mean. When you see an instance of explicit `isCommentSpam` used, you know immediately that it is using the CommentCache. Compare:

    if (isCommentSpam(423)) {
        doSomething();
    }

    if(isCommentSpam(423, commentCache)) {
        doSomething();
    }
See, the fact that the first kind uses the CommentCache is completely opaque to you when you're reading the code. You don't know it does until you actually look inside `isCommentSpam`. The second way, you can trace the flow of information through the program very easily.
Re:So Singletons are bad, then what? by shitgoose on Thursday January 30, 2014 @03:13PM (#7153064)
Well, I see what you are saying, but I still don't think this is a strong case against singletons.