What is your limit to using the factory instead of constructor to create an object?
- You always use the factory.
- You only use the factory, if you have nothing besides check for a futuristic check tap.
- You always use Constructor
- .. What are those cases ??
Pros and Cons
UPDATE: I am implementing a factory pattern in my project with a domain driven design. And one reason behind building factories is to reduce the noise in the domain model.
Thanks
If I have an abstract base class (or an interface), and There are several concrete derivative classes, and some arguments, according to which one of the concrete sections is formed. I apply that argument to the factory.
Comments
Post a Comment