I have method that can take a single file name or array/list of files, and does some processing on them as follows:
public void methodName(String file, int arg2) {
...
}
OR
public void methodName(String[] files, int arg2) {
...
}
Lets say there is equal likely chance it will take single or list of files. What is the best design approach to this situations given no other restrictions?
- Create method 1 and write wrapper around it to handle list of files
- Create method 2 and write wrapper to handle single file instance
- none of the above
What things should you consider now and for future maintainability?
Aucun commentaire:
Enregistrer un commentaire