J
jonathan.broderick
I'm needing a little bit of clarity on using the factory design
method.
Lets say I have two concrete classes that implement an interface. Then
I have two factories that instantiate objects of that type. I would
like to have the two factories adhere to a common interface for
creating the objects but the problem is that each object requires
different parameters for the constructors.
I could remove the different parameters and create common method
signatures but then I am forced to have the calling class finish
creating the object which seems dumb.
The other thing I was thinking is passing in a "params" of
Dictionary<string,object> objects that correspond to the other fields
required for creating the object. Does this defeat the factory method?
Thanks!
method.
Lets say I have two concrete classes that implement an interface. Then
I have two factories that instantiate objects of that type. I would
like to have the two factories adhere to a common interface for
creating the objects but the problem is that each object requires
different parameters for the constructors.
I could remove the different parameters and create common method
signatures but then I am forced to have the calling class finish
creating the object which seems dumb.
The other thing I was thinking is passing in a "params" of
Dictionary<string,object> objects that correspond to the other fields
required for creating the object. Does this defeat the factory method?
Thanks!