A. Craig West said:
I think the point is that it requires TWO no-arg versions of fubar, one
where the intent is to do whatever is appropriate for Gronk's, and one for
Snonk's.
If there's such a divergence in functionality then the two methods shouldn't
be overloaded versions of the same, eh? You can't have two no-arg versions
and if the logic would require two then there's *another* design flaw:
misused overloading.
If a method has two overloaded forms, then those two overloaded forms must
do the same functionality and only vary in the arguments they take in. If
they vary in functionality then they are most likely poorly named (a misuse
of method overloading) and that is a design flaw. If they have the same
functionality, and it's necessary that you be able to invoke that
functionality without a passed argument, then the design calls for an
explicit no-arg version of the method as well. Any functionality that can
be done *without* the passed arguments should be moved to the no-arg method
and those versions *with* arguments should invoke that method as necessary
during their execution.
This is not likely to be the type of thing that comes up often,
but it does come up. It would always be possible to just give the method a
more specific name, but there are those who feel that the type of the
argument is sufficient, and adding a modifier to the name is redundant.
But, the arguments *aren't* different; the casting of null to a type is to
make a different argument (null) the same *same* and depending on the
implementation to differentiate the argument from a non-null one. If the
method can function without arguments, then there should be a no-arg
version of the method.