From what I have gathered, singleton is bad and shouldn't be used frequently.
Is that the case or just singleton gets a bad rap?
When implementing AbstractFactory patterrns, I tend apply singleton to every class TypeFactory extends AbstractFactory
. Lets say ShapeFactory
and ColorFactory
, there should only be one instance of each factory, thus the use of singleton.
What you guys think? Is the usage in this case justified or bad practice?
Aucun commentaire:
Enregistrer un commentaire