Factory method question
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
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!
.
Relevant Pages
- Re: Dynamic inheritance
... >I've been reading the Factory and Abstract Factory patterns - and finding ... It seems the problem boils down to where/when to instantiate ... We have an interface named DeviceFactory. ... >Since most devices would be Cisco devices the 'cisco device' subclass would ... (comp.object) - Re: Dynamic inheritance
... >I've been reading the Factory and Abstract Factory patterns - and finding ... It seems the problem boils down to where/when to instantiate ... We have an interface named DeviceFactory. ... >Since most devices would be Cisco devices the 'cisco device' subclass would ... (comp.programming) - Re: Design Question
... You could advocate that all public methods should be declared in an interface, such that you would have no concrete class that did not implement at least one interface. ... You will have to add new getters and setters to the interface just as you would to the class, and factory method signatures will change just like constructor signatures would. ... In the approach I was advocating, the Record class would have no knowledge of persistence. ... (comp.lang.java.programmer) - Re: Overwhelmed by choices of Design Patterns
... pattern and have a great difficulty to decide which pattern to use. ... Since the same data is obtained from either source, can have a common interface and one decouples through polymorphic access. ... For example, if the basic INI format does not change but the value labels do, one can use lookup tables to provide identity matching to what the expects. ... However, if the default data is "hard-wired" in some sort of factory object in, the needs to know whether that factory initialization needs to be invoked. ... (comp.object) - Re: Delphi Challenges?
... The biggest challenge I've ever come across with Delphi is one that I am ... functionality such as a discount, I have made the discount available ... through a delegated interface to a discount object which may or may not ... The objects can use factories and factory factories to create ... (borland.public.delphi.non-technical) |
|