> From: Alex Harui [mailto:aha...@adobe.com] > Sent: 08 February 2012 03:10 > > ... And then there are some old singletons like EffectManager that still use > static methods, which should be using Singleton instead. > > And then there is the whole debate about Singletons in general...
Let's have that debate. Replacing static methods with singletons will not improve the testability of the code. If those static methods are deterministic and have no side effects, then they are fine as static methods (and maybe could be turned into global functions as a minor [though controversial] improvement.) Otherwise, they need to go. Global state, whether via singletons, service locator patterns or static methods, always make testing difficult. If we are serious about making the Flex framework unit-testable, then we need to get rid of all of them and replace them with dependency injection throughout the framework. Anything less will - from a testing point of view - just be fiddling whilst Rome burns. David.