I first want to say that I specifically point to this stackoverflow question: enter link description here
There, the accepted answere is
[ ... ] I'm sure there are other valid reasons as well. Alex Miller, in "Patterns I Hate", talks of service locators and client side UI's also being possibly "acceptable" choices.
Now I want, as a kata while comeing back to java after a long(ish) period, write a Mac-like starter bar for other Os [ unix / windows ].
The idea is to dragndrop an application icon onto it (windows) or just run any cmd command (unix) and have multiple clickable items and parameters to start the applications. ( the real-world-use of this prog. is another story lol )
As I understood the accepted answere, the class that fires up the processes (with a runtime or similar) CAN be a singleton. The website linked there is from 2007 -> waybackmashine, so I thought I'd bring this topic up here.
Are there benefits for this, is there ever a benefit to use a singleton over instances other then the so-often mentioned logger? Pls. errata if you have experiance on this topic.
TBC: The post linked specifically says
The information here flows one way: From your application into the logger. Even though loggers are global state, since no information flows from loggers into your application, loggers are acceptable.
- which would hold true for the application starter in my scenario.
I just want to learn a bit about software architecture, no need for specific implementations.
Aucun commentaire:
Enregistrer un commentaire