0% found this document useful (0 votes)
10 views2 pages

Singleton Design Pattern

The Singleton design pattern is a creational pattern that ensures a class has only one instance and provides global access to it. While it allows for lazy instantiation, its limitations include restricting the creation of multiple instances and potential performance degradation due to thread access. However, it offers controlled access to the instance, improves upon global variables, and allows for runtime configuration of the instance's functionality.

Uploaded by

PAVISHNA
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Singleton Design Pattern

The Singleton design pattern is a creational pattern that ensures a class has only one instance and provides global access to it. While it allows for lazy instantiation, its limitations include restricting the creation of multiple instances and potential performance degradation due to thread access. However, it offers controlled access to the instance, improves upon global variables, and allows for runtime configuration of the instance's functionality.

Uploaded by

PAVISHNA
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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.

You might also like