In the company i work for we are developing an application that is used from various customers (other companies). The core of the application is the same but when it comes to some details every customer has its own requirements.
I think the way to deal with this is the strategy pattern by injecting the appropriate strategy to the component that needs to use it.
My question is, is there a way to know which strategy implementation to inject depending on the customer that is using the application, without avoiding "cases", or "if elses"?
How would you implement it in real life applications?
public IStrategy GetStrategy(string customerName) {
switch(customerName) {
case "customer1":
return new Strategy1();
case "customer2":
return new Strategy2();
}
}
EDIT: As the accepted answer of this question (Strategy Pattern with no 'switch' statements?) suggests, "Strategy isn't a magic anti-switch solution.".
Are there any other opinions about that?