Package design.pattern.creational
package design.pattern.creational
-
InterfacesClassDescription
AbstractFactory
is used when we need to isolate the object creation with group of dependant objectsBuilder
is used when the constructor is complex or object creation has multiple stepsFactoryMethod
will have individual factory method classesXMLMessageMessageFactoryMethod
,JSONMessageMessageFactoryMethod
for every instances neededXMLMessage
,JSONMessage
and we cannot go withSimpleFactory
since theMessage
might be extended by different concrete classes in the futureObjectPool
is used when the object creation is costly, so we have already created a pool of objects which can be reusedSimpleFactory
is used to move the object creation in a separate method.Singleton
is used when there should be only one instance of the that class