An approach
A factory abstracts objects. Creating and configuring objects from code using an object.
If it all depends on the complexity associated with creating and initializing the object. If they are simple, then you do not need to use the factory pattern.
If it's a bit complicated (with a lot of steps to initialize before you use it), and better use the factory template.
source share