SINGLETON DESIGN PATTERN:
Definition :
● Singleton falls under the category of creational design pattern.
● It ensures that a class has only one instance.
● Also providing a global access point to this instance.
Lazy Instantiation :
● Objects are only created when it is needed.
Singleton Limitations :
● The main limitations of the singleton pattern is that it permits the
creation of only one instance of the class ,while most practical
applications require multiple instances to be initialised.
● Furthermore in case of singleton the system Threads 5 to access the
single instance, thereby degrading the performance of the
applications.
Singleton Consequences :
● Controlled access to the sole instance facilitates strict control over
when and how the clients access it.
● The singleton pattern improvement over Global variables.
● It is easy to configure an instance of the application that extends the
functionality of singleton at runtime.
● More flexible than class operations.