I'm using what I think is a Strategy Pattern to perform the same
process, but implemented in two different ways. I therefore plan to
have an Interface with a single method, and two concrete classes that
inherit from the interface, each having a different implementation of
that method.
The problem is, while both these implementations are logically
performing the same function, both need different parameters to perform
the task. This means my interface will need both versions of the
method, which means in turn both classes will need both too. I'm pretty
sure that's not right!
I'm thinking one possibility might be to have a separate class to hold
the parameters, and pass an instance of that into each method. Is that
a good or bad approach?
Alternatively, am I approaching this in completely the wrong way - is
there another pattern I should be using?
I'm new at this, so any help is greatly appreciated.
Many thanks
Gerry