News for hackers. Stuff that matters.
Re:Google Singleton Detector by saraid216 on Friday July 08, 2011 @06:13PM (#2744302)
The solution is essentially to take a hard look at your design and see why you have to pass around config options, event loops, or message buses to begin with. The need to access global state is a code smell.

When you DO need global state, then a singleton object is a reasonable way to achieve it. But chances are fairly high that you don't.

Re:Google Singleton Detector by ebiester on Friday July 08, 2011 @08:14PM (#2744618)
You can look for days, and if you don't know any of the alternatives, none will pop out.

As I'm not in the mobile sphere, I wouldn't know how to avoid a singleton for an app that is constrained by speed and space requirements. I've already shown an example above, what's your solution in this environment, with the constraints of the questioner?