I have to implement a solution where the code behaves differently according to a different condition.
For example:
if(condition) {
//create one object
} else {
//create another object
}
someCommonMethod();
if(condition) {
//do one thing
} else {
//do another thing
}
someCommonMethod();
Even the code inside the conditions is shared sometimes, it's just slightly variations of it. What would be the best approach here? What would be the best Design Pattern?
Aucun commentaire:
Enregistrer un commentaire