4 ms·
Do you have any advice for avoiding singletons? Consider I have a singleton that does Geographical lookups and requires a substantial amount of time to load/pr
by 727374 13y ago
Do you have any advice for avoiding singletons? Consider I have a singleton that does Geographical lookups and requires a substantial amount of time to load/process data mapping. This data never changes after the initial load. Would it be better to make the singleton private and to access it via a non-singleton instance of the class (or subclass) it lives in?
- dljsjr 13y agoFind a way to persist the data if it doesn't change frequently, or if you need it to be an in-memory object then pass the object around to classes that need it as others have alluded to.