What is the disadvantage of using the Singleton pattern? It is enticing to use this pattern for all the classes as it makes it easy to get the reference of the singleton object.
Created May 4, 2012
John Moore The intent of the Singleton pattern is to ensure
a class has only one instance and to provide a
global point of access to it. True, the second
part about providing a global point of access is
enticing, but the primary disadvantage of using
the Singleton pattern for all classes is related
to the first part of the intent; i.e., that it
allows only one instance of the class. For most
classes in an application, you will need to create
multiple instances. What purpose would a Customer
class serve if you could create only one Customer
object?