Posts tagged as 'Singleton'

Singleton Factory

I’ve mentioned before how I dislike the Singleton pattern… So this morning I was experimenting with various other possible ways to create singletons in Actionscript 3 and came up with a function that can be used to create and reuse a single instance of any class. I don’t know how useful it will turn out to be but here it is. It’s also a useful example of a package level function…

Singletons – we’re better off without them

With the introduction of Actionscript 3 there was a lot of discussion about how to implement the singleton design pattern. This happened because Actionscript 3 doesn’t allow private or protected constructors and this prevents the most common implementation technique for singletons. But singletons are never actually needed and are rarely a good idea.