3 ms·
Wish someone asked his opinion on "singletons". I've been fan of them in the past, and now I totally despise them... But then it came to me, that I don't despis
by malkia 15y ago
Wish someone asked his opinion on "singletons". I've been fan of them in the past, and now I totally despise them... But then it came to me, that I don't despise the semantics of he singleton - I just write that as a bunch of functions, rather than class with methods that is "singleton-ized".
There were also some revelations - like printer().getSingleton() (or instead of printer, put keyboard, mouse, memory, etc.) - at some point some of these "singletons" might be become "multi-tons" - for example gamepad().getSingleton() already is a trouble...
- Ingaz 15y agoThe best "singleton" for me is python module. Import is the constructor of singleton. Python itself controls single initialization of object.
- justncase80 15y agoTao of Leo #25: http://justinmchase.com/2012/02/22/tao-of-leo-25/ http://justinmchase.com/2012/02/22/tao-of-leo-25/ "The singleton pattern combines all the perf benefits of a global variable with all of the code maintenance benefits of a global variable."