2 ms·
I'm not one to defend singletons (been burned by them myself), but this is a pretty poor example of why they suck. Any singleton that requires an outside .init
by MatthewPhillips 16y ago
I'm not one to defend singletons (been burned by them myself), but this is a pretty poor example of why they suck. Any singleton that requires an outside .init() call is a pretty poor singleton. The whole point vs. globals is that they are lazy loaded. Why not:
getInstance() {
if(_instance == null) { init(); }
return _instance;
}