Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. In software
engineering, the singleton pattern is a design pattern used to implement
the mathematical concept of a singleton, by restricting the
instantiation of a class to one object. This is useful when exactly one
object is needed to coordinate actions across the system. The concept is
sometimes generalized to systems that operate more efficiently when only
one object exists, or that restrict the instantiation to a certain
number of objects. There is criticism of the use of the singleton
pattern, as some consider it an anti-pattern, judging that it is
overused, introduces unnecessary restrictions in situations where a sole
instance of a class is not actually required, and introduces global
state into an application.