May 2019
Beginner to intermediate
548 pages
12h 39m
English
The Singleton Pattern is a creational pattern used for creating one instance of a class and to use that instance as a global point of access. This means that the instance of this class cannot be created more than once. If we want to create a new instance of this class, we first need to destroy the previous instance.
But, sometimes, the Singleton pattern is treated as an anti-pattern. Why? Singleton as a pattern is not a problem but it is often badly used. Programmers use singleton like a global variable. Singleton also makes code harder to refactor and maintain. Sometimes, we find out that we need more than one instance, but we cannot create them because a Singleton Pattern has been used. In that case, it may ...
Read now
Unlock full access