Showing posts with label Singleton. Show all posts
Showing posts with label Singleton. Show all posts

Thursday, October 2, 2014

From Singleton to AOP (And Everything in Between)

This article on game development touches on the nuances faced and the angst developers face when dealing with complex systems and still adhering to best practices ala IoC. The highest voted answer seems to favor neither the service locator pattern nor the singleton, but seems to lean toward dependency injection ("passing around the instances"). Nevertheless the OP appears to settle on Service Locator.
http://gamedev.stackexchange.com/questions/84197/how-can-i-avoid-having-many-singletons-in-my-game-architecture

An alternative to all three could be AOP as shown in this old article: http://blogs.msdn.com/b/simonince/archive/2008/06/30/dependency-injection-is-dead.aspx

But if you think that DI is hard, DI via AOP is certainly an order of magnitude harder -- which is probably why it's not spoken of much.

Saturday, September 14, 2013

Singletons vs. Modules

A module is the language level implementation of a singleton without the need to prepend self to every methods argument list.
http://stackoverflow.com/questions/3498200/organising-classes-and-modules-in-python

Monday, June 18, 2012

Singleton Anti-Pattern

Always ask for a reference! (don’t create, or look-up a reference in global space aka Singleton design anti-pattern) 
 http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/