Design Pattern

Singleton Design Pattern

Singleton Design Pattern is used to restrict instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. Examples would include objects needed for logging, communication, database access, file manager, scheduler, etc. You could pass such an instance from method to method, or assign it to each object in the system. However, this adds a lot of unnecessary complexity. Simply put, singleton ensures that a class has only one instance, and provides a global point of access to it.