3 ms·
Don't fall the trap of the cargo culture thinking. Google has a completely different problem than you do. Their code spans hundreds of thousands (or millions),
by mirkules 15y ago
Don't fall the trap of the cargo culture thinking. Google has a completely different problem than you do. Their code spans hundreds of thousands (or millions), of code, in distributed systems, etc..
This is probably the single most useful quote in this entire discussion. Singletons are not inherently bad -- they were created for a reason, but because people abuse them, they have a bad rep.
- misterbee 15y agoIf you aren't writing an actual hardware device driver for a specific peripheral port, you are abusing Singleton.
- mirkules 15y agoThere are many instances where you need just one instance of a class, not just a hardware device driver (for instance, when you need GPS location coordinates on a mobile device across several different classes).