Why aren't you using a static class for that instead of a Singleton?


Mendelsohn, Michael wrote:
Thanks for the responses everyone.
Steven, I could use some constructive feedback:

Usually what I do is have a singleton instanced when the swf is
initialized, and using composition, other classes are instanced within
the singleton.  So the singleton becomes a sort of tree trunk with
everything branching off of it.  How would you say that this is a bad
idea?  It's worked well for me.  What would be a more effective
alternative to structuring my swfs?

- MM



Singletons are overused and, except in rare instances, are a bad idea.

Singletons are acceptable if you're writing throwaway code, like agency
stuff where getting it done under tight deadlines is more important than getting it done in the most scalable and flexible way.

A Singleton is just a global.  IMO, globals are helpful when hacking,
but generally bad practice. If it was called Globalton, people wouldn't think so highly of it just because it's a "Design Pattern". Most people misuse Singleton, anyway.

http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/

http://googletesting.blogspot.com/2008/05/tott-using-dependancy-injectio
n-to.html

http://googletesting.blogspot.com/2008/08/where-have-all-singletons-gone
.html


Google even has a tool that detects Singletons in Java so you can
refactor them out.

http://linux.softpedia.com/get/Programming/Quality-Assurance-and-Testing
/Google-Singleton-Detector-29295.shtml

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to