Singleton pattern

E679874

The Singleton pattern is a creational design pattern that ensures a class has only one globally accessible instance, commonly used to provide shared resources or centralized control in software systems.

All labels observed (2)

Label Occurrences
Monostate pattern 1
Singleton pattern canonical 1

How this entity was disambiguated

Statements (51)

Predicate Object
instanceOf creational design pattern
software design pattern
aimsTo control object creation
prevent multiple instances of a class
alternativeTo dependency injection in some scenarios
belongsTo Gang of Four design patterns
canCause difficulty in unit testing
global state issues
hidden dependencies
tight coupling
category creational pattern
commonIn application-wide registries
caches
configuration managers
connection pools
logging components
criticizedFor encouraging global state
hindering parallelism if not thread-safe
reducing testability
defines a static method to access the instance
describedIn Design Patterns: Elements of Reusable Object-Oriented Software
ensures a class has only one instance
a single globally accessible instance
firstPopularizedBy Erich Gamma
John Vlissides
Ralph Johnson
Richard Helm
hasVariant eager Singleton
enum-based Singleton in Java
lazy Singleton
thread-safe Singleton
oftenImplements eager initialization
lazy initialization
oftenUses double-checked locking for thread safety
synchronization mechanisms
provides global access point to an instance
relatedTo Monostate pattern
linked to: Singleton pattern

Service Locator pattern
requires a static reference to the single instance
controlled instantiation logic
private constructor in many languages
requiresCareful thread-safety handling in multithreaded environments
typicalImplementationLanguage C#
C++
Java
Objective-C
Python
usedFor centralized control in software systems
coordinating actions across a system
managing access to a single resource
providing shared resources

How these facts were elicited

Referenced by (2)

Full triples — surface form annotated when it differs from this entity's canonical label.

Flyweight oftenUsedWith Singleton pattern
Singleton pattern relatedTo Monostate pattern
linked to: Singleton pattern