Singleton Pattern Deprecated

The SingletonPattern is not a best practice. It is not up to the standards of many of the other design patterns and should not be used. It should therefore be deprecated in favor of accomplishing the legitimate goals of the SingletonPattern by other means.

Example Legitimate goals of the SingletonPattern:

A reasonable need in systems is the avoidance of contention -- for instance, by the appropriate temporal enforcement of cardinality. That would be for objects whose cardinality is germane to the function of the object, within that period of time. Example: Serialization of access to a specific resource that is constrained in some way. Say, specifically, a single network adapter or its interface.

Providing context information whose source is beyond the scope of the object requiring the context information. Also, providing outbound communication to objects out of the current scope. Example: (as in GOF) A logging facility.


EditText of this page (last edited February 23, 2006) or FindPage with title or text search