The use of the Singleton pattern in software product development

Authors

  • Nemchenko V.V. https://orcid.org/0000-0003-2262-719X , Cherkasy State Technological University image/svg+xml
  • Piven O.B. https://orcid.org/0000-0001-5601-8304 , Cherkasy State Technological University image/svg+xml
  • Salapatov V.I. https://orcid.org/0000-0001-7567-637X , Cherkasy State Technological University image/svg+xml

DOI:

https://doi.org/10.34121/1028-9763-2026-3-103-111

Keywords:

design pattern, generative patterns, Singleton, hierarchical structure, software engineering, software architecture, software design, web technologies, web programming

Abstract

In the modern world, processes in software engineering are developing at a rapid pace: technologies are updated frequently and the life cycle of software solutions is becoming shorter, so previous experience cannot always serve as a reliable basis for forecasting. Under limited resources, the use of proven design solutions, in particular design patterns, is one of the ways to increase the resilience of software products to change. The article provides a systematic analysis of the creational Singleton pattern, which guarantees the existence of only one instance of a class and provides a global point of access to it throughout the program’s life cycle. The theoretical foundations of the pattern, its key properties (private constructor, static field, and getInstance method), and typical usage scenarios — logging, configuration, database connection pooling, and caching — are examined. A comparative analysis of the main implementations (Eager and Lazy Initialization, synchronized method, Double-Checked Locking with volatile, Initialization-on-Demand Holder, std::call_once) is carried out according to the criteria of thread safety, performance, and complexity. Based on the systematization of data on the average getInstance() call time in a multithreaded environment, practical recommendations are formulated for choosing an implementation depending on the programming language and the system nature. The paper also outlines cases in which alternatives — Dependency Injection or Service Locator — are more appropriate. There is no universally best implementation, since each option is a trade-off between speed, memory usage, and code complexity. Prospects for further research are identified, in particular the behaviour of Singleton in cloud environments, its interaction with IoC containers, and automated detection of the pattern using static code analysis tools. Tabl.: 2. Figs.: 5. Refs.: 11 titles.

References

1. Gamma E., Helm R., Johnson R., Vlissides J. Design patterns: Elements of reusable object-oriented software. Addison-Wesley, 1994. 395 р.

2. Sa’adah U., Hasim J.A.N., Hisyam M. Implementing Singleton method in design of MVC-based PHP framework. International Electronics Symposium (IES). IEEE. 2015. P. 212–217. DOI: https://doi.org/10.1109/ELECSYM.2015.7380843.

3. Hasim J.A.N., Damastuti F.A., Saadah U. Developing Microframework based on Singleton and Abstract Factory Design Pattern. International Electronics Symposium (IES). IEEE. Surabaya, Indonesia, 9–11 August 2022. P. 676–683. DOI: https://doi.org/10.1109/IES55876.2022.9888548.

4. Nacef A., Sehimi S., Bahroun S., Ben Ahmed S. Singleton and Factory Design Patterns Detection Based on Features and Machine Learning. Communications in Computer and Information Science. Springer, 2024. P. 189–210. DOI: https://doi.org/0.1007/978-3-031-64182-4_9.

5. Sabbag Filho N. The Singleton Pattern in Scalability Contexts: Performance Evaluation and Maintenance Impacts of Systems. ResearchGate, 2024. P. 1–6. DOI: https://doi.org/10.5281/zenodo.13719389.

6. Andersen G. MoldStud Research Team. Exploring Alternative Patterns — When to Replace the Singleton Design Pattern. MoldStud, 2025. URL: https://moldstud.com/articles/p-exploring-alternative-patternswhen-to-replace-the-singleton-design-pattern (дата звернення: 16.06.2026).

7. Bloch J. Effective Java. 3rd ed. Boston: Addison-Wesley, 2018. 416 p.

8. Goetz B., Peierls T., Bloch J., Bowbeer J., Holmes D., Lea D. Java Concurrency in Practice. Boston: Addison-Wesley, 2006. 384 p.

9. Bacon D., Bloch J., Bogda J., Click C., Haahr P., Lea D. et al. The «Double-Checked Locking is Broken» Declaration. University of Maryland, 2001. URL:https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html (дата звернення: 16.06.2026).

10. Williams A. C++ Concurrency in Action. 2nd ed. Shelter Island: Manning, 2019. 592 p.

11. Neelan A. Singleton Pattern Implementations and Thread Safety Considerations in Multithreaded Environment. International Journal of Core Engineering & Management. 2025. Vol. 8, Issue 2. P. 5–14. DOI: https://doi.org/10.5281/zenodo.15486141.

Downloads

Views: 16
Downloads: 12

Published

2026-09-14

Issue

Section

SIMULATION AND MANAGEMENT

How to Cite

The use of the Singleton pattern in software product development. (2026). Mathematical Machines and Systems, 3, 103-111. https://doi.org/10.34121/1028-9763-2026-3-103-111