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.

Try in SPARQL Jump to: Statements Referenced by

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 NERFINISHED
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 NERFINISHED
ensures a class has only one instance
a single globally accessible instance
firstPopularizedBy Erich Gamma NERFINISHED
John Vlissides NERFINISHED
Ralph Johnson NERFINISHED
Richard Helm NERFINISHED
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 NERFINISHED
Service Locator pattern NERFINISHED
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# NERFINISHED
C++ NERFINISHED
Java NERFINISHED
Objective-C NERFINISHED
Python NERFINISHED
usedFor centralized control in software systems
coordinating actions across a system
managing access to a single resource
providing shared resources

Referenced by (1)

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

Flyweight oftenUsedWith Singleton pattern