we have some API which will be called either by client A, B, C or D
Current code
doSomething(String client){
if (client.equals("A")){
...
}
else if (client.equals("B")){
...
}
Proposed refactoring 1
separate into multiple methods and have each client call the dedicated method such as
doSomethingForClientA()
doSomethingForClientB()
we need this because internally each method will call other private methods defined in the same class
Proposed refactoring 2
Use strategy (or template) pattern and separate into multiple classes for the clients to call
the method call from client remains
doSomething()
Which approach is better in the long run? Is there any design pattern to help with option 1 ? or a 3rd option?