Overloaded methods tend to encourage the habit of duplicating code between all methods in a group of methods. For example, I can concatenate a string, write it to a file, etc. In one way, and then do the same in another method, but with the addition of an additional parameter (creating overload).
The methods themselves can go in a base class that will make a particular class cleaner, but then the base class will have a problem (working on the problem). The params keyword seems like a solution, but I can imagine if I really think about this idea (using parameters, not separate parameters), there will be some other problem.
So, am I the only one who thinks that overloads contribute to code duplication?
thank
source
share