So I have a class called app. It is just a class that controls all the other classes inside of it. Mid development we discussed to make this app class a singleton. This makes clear to other developers that there should only be one App. This sounds logical and is the correct way to use a singleton. The only questions arises that if you use this singleton to access its properties and make them accessible for others. Are you then using a singleton "incorrectly"? I know you should not use singleton "because it's convenient". But is this the case here?
Asked
Active
Viewed 27 times
1 Answers
2
If you use this singleton to access its properties and make them accessible for others, are you then using a singleton "incorrectly"?
Short answer: No
Long answer: It depends

Medet Tleukabiluly
- 11,662
- 3
- 34
- 69
-
I reckon that the long answer is too long to answer in a post. Is there anywhere I can do some research to understand it? – jessey stend Jan 16 '20 at 14:16
-
@jesseystend https://www.freecodecamp.org/news/singleton-design-pattern-pros-and-cons-e10f98e23d63/ – Medet Tleukabiluly Jan 16 '20 at 14:18
-
Thanks @MedetTleukabiluly, I read the article and it helped me understand singletons a little more. – jessey stend Jan 16 '20 at 14:35