If you add a third signature for a method, do you make the second and third variations directly call the first (the implemented variation), or do you make the third call the second and the second call the first.
It would seem to me that the extra method call would be overhead you could live without, so you'd want all the methods to call the implemented method directly.
I was wondering if anyone knows of any "standard recommended way" of doing this or if it's more personal preference or depends on context. I always wonder about it when I add a new signature to an existing overloaded method. You almost always have a choice of which way to do it.
Pathetically Stupid Example:
Existing methods:
public String concatenate(String one, String two, String three) {
return(one+two+three);
}
public String concatenate(String one, String two) {
return(concatenate(one, two, ""));
}
To add the next one, do I do:
public String concatenate(String one) {
return(concatenate(one,"",""));
}
OR
public String concatenate(String one) {
return(concatenate(one,""));
}
and yes, I am aware that the final method is essentially a no-op.