Singleton without the bad side effects
Singleton pattern gives a way of ensuring that there is only a single instance of a particular object – but why has the singleton become an anti-pattern? Well, the main issue with singleton is that it becomes very difficult to test since it is very likely that it’s tightly coupled to a something within the system – it’s just the nature of the singleton pattern, since it has to be able to create itself, and in order to do so, it needs to be able to gather everything it depends on by itself – not to mention issues with thread-safety if not done right.