Answer the question
In order to leave comments, you need to log in
How to use the Singleton pattern correctly?
Good day, I recently learned about Singleton. The thing is beautiful and convenient, the desire to cram it everywhere is huge. I read that it is better to put on unique objects. How correctly, and under what conditions should it be used, and how can it - the pattern harm the project?
Answer the question
In order to leave comments, you need to log in
Singleton is a pattern (template). There are no rules and instructions on how to use it, he himself is the rule . If you understand what Singleton is, then you simply use this approach in your algorithms. And this can be said about any pattern.
And if you asked such a question, then you probably do not understand what a pattern is, and even more so a Singleton. so learn the language and learn to program while without it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question