|
Posted by Tony Marston on 08/10/06 12:44
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:JqqdnZopOJbhTUTZnZ2dnUVZ_radnZ2d@comcast.com...
> Tony Marston wrote:
>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> news:2L6dnVvcUY7DukTZnZ2dnUVZ_vednZ2d@comcast.com...
>>
>>>Tony Marston wrote:
>>>
>>>>"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>news:MbydnaBugoftvUrZnZ2dnUVZ_qOdnZ2d@comcast.com...
>>>>
>>
>> <snip>
>>
>>>>Can you point to to any papers on the internet which say that such a
>>>>practice is a good thing?
>>>>
>>>
>>>That wasn't what I said. I said use the same function name - including
>>>case - in different functions. In language such as C++ and Java you
>>>could have any number of functions called "readFile". But I'm sure your
>>>poor brain would blow at such an idea.
>>
>>
>> Just because you *could* have many different functions with the same name
>> does not mean that you *should*. Most people would find that confusing.
>>
>
> Well, it's required for one of the mainstays of OO programming -
> polymorphism - in every OO language.
Having the same method available in different classes, especially when
provided via subclassing, is not the same as having a single method name
with the same spelling but different case mean different things. There is a
diference between the two cases.
> And even without polymorphism requirements, it works quite well. Only
> stoopid Tony would find it confusing. Most people find it more confusing
> to have things like:
>
> printInt
> printString
> printDouble
> printEmployee
>
> etc. They find it much clearer to have one function name "print".
A single function called print() is not the same as a series of different
functions, which you advocate, called print(), prinT(), priNt() and prInt()
There is nothing obscure about a function with the same spelling meaning the
same thing regardless of case. But when a slight change in case is used to
produce a tonally different function? Now *that* leads to obfuscated and
unmaintainable code.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
Navigation:
[Reply to this message]
|