oop - Is this a good use of the Singleton pattern? -


I design a lot of "own" ____ "applications.
What I have to do is to catch all the customizations chosen by a singleton user, for example: When you choose that you want something beat, it turns the gates / setter into green color in green. Then when the application needs to know which color was selected, it has got information from the same recipient / setter.
The way I used to do this was accumulating the information in the UI (which color was selected from just the drop-down). After reading about the MVC (I still do not understand "completely" MVC), I know that it is completely wrong and that is why I have given it to the singleton class which keeps it all,

Now I am thinking that this is also a bad idea? If so, how should I do it?

Thank you.

Let me say that what was not really the purpose of the singleton pattern. This is a very misunderstood pattern and the most common reason people are used to it is that they can easily reach after being stable. What is actually happening is that you have a configuration problem that you are trying to get through a stable singleton that can easily reach the whole app. A 'fair' experiment will happen when actually trying to control access to limited resources.

If you think about it, then perhaps there is no meaning of just one universal 'configuration' for an application. It makes a lot more sense, but perhaps only one use can happen at any time.

-Edit - Instead of using a singleton which can be considered for the use of stability injection or inverted control.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -