Hey. You can't initialize me, but you can get the only one instance of myself which is shared across your app by asking my static sub-routine. I can help you with what I can. -- Singleton class This is a continuation of the software design patte...

Markdown supported · ⌘↵ to post
Nice article
In my opinion, Singleton should be always avoided. It is as dangerous as you mention because it brings lots of coupling
I have encountered singleton as logger many times and I wasn't able to test them (you can't test singletons)
So I wrote an article on how to decouple the logger (by removing the singleton) here.
I'm certain they're a lot of times when we need an object to be well known, and I think there are several better alternatives than making it Singleton.
I don't pretend to hijack your post. They are just my two cents.