|
Pattern to add variation to class
Hello,
I am trying to modify a class that needs a lot of if/then/else
statements inside some of the public methods. I looked at the Strategy
and State patterns, but my main problem is that some of the methods I
thought about moving to the State/Strategy classes have dependencies
on non-variated methods, that is, the context class.
My intent is to pick class A
class A
{
public:
M1();
M2();
M3();
}
and move let's say M2() and M3() to the new classes (variated
methods).
Please let me know what do you think.
Thanks,
Fabio
|