3 ms·
No no, singletons are pathological liars http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/ http://misko.hevery.com/2008/08/17/singletons-are
by inglor 11y ago
No no, singletons are pathological liars http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/ http://misko.hevery.com/2008/08/17/singletons-are-pathologic...
Atomic mutable global state is still mutable global state. DI containers mean you don't need a singleton but can just create a single instance which lets you scope it and does not mix lifetime duration and object properties.
- incepted 11y ago> No no, singletons are pathological liars http://misko.hevery.com/2008/08/17/singletons-are-pathologic.. http://misko.hevery.com/2008/08/17/singletons-are-pathologic.... No, only badly implemented ones are. Besides, this article is seven years old and it was written way before DI with Guice or Dagger became a thing. It's a very outdated perspective (and you will notice that AngularJS, which Misko contributes to, supports both DI and singletons).
- incepted 11y ago> DI containers mean you don't need a singleton but can just create a single instance So... a singleton.