|
|
|
|
|
by saraid216
5457 days ago
|
|
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. |
|
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?