News for hackers. Stuff that matters.
Re:From STUPID to SOLID Code! by 727374 on Tuesday July 30, 2013 @01:04PM (#6128333)
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?
Re:From STUPID to SOLID Code! by dljsjr on Tuesday July 30, 2013 @03:03PM (#6129249)
Find 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.