Understanding the Singleton pattern
The Singleton pattern is a creational pattern that allows developers to ensure that there will only be a single instance of a class throughout the application and this class is globally accessible to all other classes. The way that developers usually implement the Singleton pattern is by making the constructor method private. They then provide an alternative static method that will act as a constructor method. Instead of returning a new instance of the class every time, this method always returns the same instance, ultimately allowing the existence of only one instance.
Well, this is the technical approach in which most programming languages implement the Singleton pattern, but something that I want you to keep in mind is that there is no unique way to implement design patterns. They are solutions to problems and, ultimately, when we implement them, we are looking more into getting their benefits than being strictly technical and rigid regarding...