''( reposted without permission from news:comp.object )'' Squeamizh wrote: ''I've heard repeatedly that SingletonPattern should be avoided unless there is a direct need for an object with a single access point. In other words, singletons are not meant to be used just for the convenience of not having to pass around a general purpose object from function to function. I followed this mantra for quite a while, but frankly, I found that the effort and complexity required to avoid the use of singletons exceeded what might be required in the future if I needed to decouple my design from its use of singletons. Basically, I found that I was wasting time and overcomplicating my designs because of a near religious fear of singletons!'' ''I am curious about the general attitude of this group towards the use of singletons for convenience, as opposed to necessity.'' The thing to notice about singletons is that they obscure design. When you make something a singleton, you are saying that it can be accessed everywhere, but the fact is if you have an object that -is- accessed everywhere you have no layering in your system. When you seek to provide that object only where you need it, layers emerge. Your design becomes different. If you're not used to working this way, you may end up with some ugliness.. places where you are passing objects from class to class, but if you introduce 'LayerSupertypes', the passing doesn't happen as often, and you end up with designs where the use of a particular object is localized. It gives you better separation of concerns. An example.. if you have a "configuration" singleton that you scatter across your app and you move toward a design where it is only used in, say, one hierarchy.. your code ends up with better change characteristics. In Meyer's terms, it obeys the OpenClosedPrinciple. In Fowler's, you avoid 'ShotgunSurgery.' MichaelFeathers http://michaelfeathers.typepad.com http://www.objectmentor.com --- Are there any references to exactly what "Layer Supertypes" means? A few minutes googling didn't find anything.