I have a scenario where I am using an interface implementation like
interface Sorter {
public void sort(A a, B b){}
}
and then there are several implementation of the classes like
class RankSorter extends Sorter {
public void sort(A a, B b) {
// use a alone to sort
}
}
class WeightSorter extends Sorter {
public void sort(A a, B b) {
// use a alone to sort
}
}
and some more classes where we use only the value of a alone for the sort and finally one class like below where we use both a and b.
class MultiSorter extends Sorter {
public void sort(A a, B b) {
// use both a and b for the sort operation
}
}
So my concern here is the value of b is passed to all of the sorters even though it's used only on one sorting class.
Is this the correct approach or is there a better approach ?
Aucun commentaire:
Enregistrer un commentaire