At work I got asked to refactor a large switch statement so I dicided to do a strategy pattern very simular to this link strategy pattern. However some developers in the team found it very difficult to read and was trying to convince them that by having large switch statement it's breaking the open close principle and very hard to maintain when it comes to adding more functionality to it. So the alternative could be using a factory pattern to encapsuate each switch condition but I have the same feeling that the team wont like that either. So I am open to suggestions here guys.
Aucun commentaire:
Enregistrer un commentaire