Singleton design pattern


The Singleton design pattern is a creational design pattern that restricts the instantiation of a class to a single object and provides global access to that instance throughout the application.

It is useful in situations where multiple instances of a class are undesirable or a single point of control or coordination is required.

Typical examples include logging systems, database connection managers, caches, and thread pools, among others.

Singleton design pattern