Using a singleton in my app. Am i implementing it correctly?

34 views Asked by At

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?

1

There are 1 answers

3
Medet Tleukabiluly On BEST ANSWER

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