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.
Tag: General Programming
So I’ve finished one of the books I wanted to read this year. Much of the content of the book itself will be familiar to most developers with one or two years of experience developing applications, but there are still great tips here that can easily be overlooked.