I have several Java classes that implement a strategy template. Each class has variable parameters for the number of different types:
interface Strategy { public data execute(data); } class StrategyA implements Strategy { public data execute(data); } class StrategyB implements Strategy { public StrategyB(int paramA, int paramB); public data execute(data); } class StrategyC implements Strategy { public StrategyC(int paramA, String paramB, double paramC); public data execute(data); }
Now I want the user to be able to enter parameters into some kind of user interface. The user interface should be selected at runtime, i.e. Strategies should be independent of it. The parameter dialog should not be monolithic, and it should be possible to make it behave and look different for each strategy and user interface (for example, the console or Swing).
How would you solve this problem?
java oop design-patterns model-view-controller strategy-pattern
user141335
source share