You are here: Re: Case sensitivity in programming languages. « PHP Programming Language « IT news, forums, messages
Re: Case sensitivity in programming languages.

Posted by Tony Marston on 08/07/06 11:08

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:P5adnaWnUuNdiUvZnZ2dnUVZ_r-dnZ2d@comcast.com...
> Tony Marston wrote:
>> "Shelly" <sheldonlg.news@asap-consult.com> wrote in message
>> news:V_2Bg.10122$157.5481@newsread3.news.pas.earthlink.net...
>>
>>>I don't know if I should even respond to this but I will. I guess that
>>>is because I am a "moron (sic)".
>>>
>>>"Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message
>>>news:eb29q4$htf$2$8300dec7@news.demon.co.uk...
>>>
>>>>Imagine you are working on a program and you come across a refenece to a
>>>>function called readfile(). You don't know what it does exactly. so you
>>>>look it up Ten some time later you come across a reference to a function
>>>>called readFile(). You don't notice that one letter has changed case, so
>>>>you don't realise that it is not the same function as the one you
>>>>remember and therefore has completely different behaviour and possibly
>>>>completely different consequences. Later on you discover that there is a
>>>>whole group of *different* functions which have exactly thesame
>>>>spelling, but where the only difference is a change of case in one or
>>>>two letters.
>>>>
>>>>Let me ask you a simple question. If you were to write a series of
>>>>functions which performed some sort of file access which naming
>>>>convention would you choose?
>>>>
>>>>Option (a) - readFileByIndex(), readFileSerially(), readNext() and
>>>>readPrevious()
>>>>
>>>>Option (b) - readfile(), readFile(), ReadFile() and READFILE()
>>>>
>>>>How many people think that option (b) is "kewl" and preferable to option
>>>>(a)?
>>>
>>>First, and here is what you CONTINUOUSLY fail to get through your head.
>>>Any (professional) programmer who has worked for any small time with case
>>>sensitivity, would NEVER confuse readfile(), readFile(), ReadFile() and
>>>READFILE(). He/She would AUTOMACTICALLY assume they are different
>>>functions that do more less the same thing but have different scopes and
>>>areas of applicability. THERE IS NO CONFUSION. The only confusion is by
>>>programmers who refuse to learn that there is a whole new world out
>>>there. There is a saying, "adapt or die". Please read "Who Moved My
>>>Cheese".
>>
>>
>> I disagree. Only a small number of programmers work with languages which
>> allow such a thing, therefore most programmers would expect readfile(),
>> readFile() and ReadFile() to be the same thing. To delibereately create
>> different functions with the same spelling but different case is to
>> create obfuscated and unmaintainable code. In my opinion, of course.
>>
>
> Prove this statement. References to numbers other than the ones Tony made
> up.

Read the essay "How to write unmaintainable code" at
http://mindprod.com/jgloss/unmainnaming.html and look at item 21.

>>>What would I do? I would use functions readFileByIndex(),
>>>readFileSerially(), readNext() and readPrevious() to do the specific
>>>jobs involved.
>>
>>
>> That's a step in the rght direction, to follow the conventions that have
>> existed amogst ALL good programmers for decades.
>>
>
> Fortunately better conventions have come along. Do you ride a horse to
> work? They were around long before automobiles!

YOU may think that the ability to define different functions and variables
with the same spelling but different case is a clever thing to do, but most
programmers do not. The fact that something is POSSIBLE does not mean that
it is OBLIGATORY.

>>> I would also use readfile(), readFile(), ReadFile() and READFILE() to do
>>> a more generalized read, but where the scopes are different and I would
>>> do that according to the accepted conventions.
>>
>>
>> Accepted conventions are to give different funtions different names, not
>> the same name with different case.
>>
>
> In COBOL. In case sensitive languages it's quite common to give functions
> which do basically the same thing the same name.

Only if you want to write unmaintainable code. Check out item 21 on
http://mindprod.com/jgloss/unmainnaming.html

> And in OO languages it's required for polymorphism (oops, sorry - that
> word is too long for your meager brain to understand)

Wrong! A method in a subclass which has the same name as a method in the
superclass is not a *different* method which exists *in addition to* the
parent method. It overrides the method in the superclass. Even *I* know
that.

>>> That is the meaning of PROFESSIONAL.
>>
>>
>> You mean a professional obfuscator.
>>
>
> No, a PROFESSIONAL - versus a has-been Neanderthal who doesn't have the
> intelligence to understand new techniques - or at least too stubborn. Or a
> PROFESSIONAL TROLL who starts threads like this just to see his name in
> print.

Just because it is POSSIBLE to create different functions and variables with
the same name but different case does not suddenly make it OBLIGATORY. This
is a practice that many experienced programmers would avoid like the
plague - unless, of course, you like writing unmaintainable code.

> You have a real problem with self esteem, Tony. I suggest you seek
> professional help. Then find another career. I hear the circus needs
> someone to clean up after their elephants.

I do not have a problem with my self-esteem. I have an opinion which I hold
for perfectly valid reasons, and nothing you can say will deflect me from
either holding or expressing that opinion.

>>>So, Tony, it is not an either-or.
>>>
>>>As for your insulting me, I will give you enough time to apologize to me.
>>>After all I, as a programmer, fall into the category of "any programmer
>>>who". After that time, if you have not apologized, you will be deposited
>>>into my killfile.

Read what I wrote. I did not call *YOU* a moron directly. I said "anybody
who does such [a moronic thing] is a moron". If you own up to actually doing
that moronic thing then hat is your admssion, not mine.

>> Oh good. Then will not be subjected to any more of your stupud ideas.
>>
>
> Yes, I can only wish we will not be subjected to your asinine comments.

So any opinion whch dffers from yours automatically becomes an "asinine
comment". Only an "ass" would say that.

<snip>
>
>>>>Imagine you are writing code to transfer funds from one account to
>>>>another, which means that you need to hold two different account
>>>>numbers. Which naming convention would you choose?
>>>>
>>>>Option (a) - account_from, account_to
>>>>
>>>>Option (b) - account, Account
>>>>
>>>>How many people think that option (b) is "kewl" and preferable to option
>>>>(a)?
>>>
>>>Neither. I would name them accountSource accountDest. OK, that is
>>>nitpiking. I would choose A. However, that is NOT the purpose of
>>>account vs. Account. It would be a poor use of case sensitivity.
>>
>>
>> So you agree that option (a) is better and opton (b) is not good
>> practice. Then why allow option (b) n the first place if it's use leads
>> to obfuscated and unmaintainable code?
>>
>
> B would not be used like you claim. Stop twisting what other say, Tony.
>
> Account would be the class name. account, accountSource, accountDest and
> so on would be objects of the class Account.

No, I am not twisting what you say. You say that you support the use of
different names with the same spelling but different case to mean different
things. I say (and others do to) that this leads to ubfuscated and
unmaintainable code

>>>>>>Or am I the only person who can see this?
>>>>>
>>>>>Apparantly.
>>>>
>>>>Then you are blind. Or stupid. Or both.
>>>
>>>I didn't read the whole thing before starting my response and getting to
>>>ths. I take back my apology statement above. Me, reading you insulting
>>>me once, shame on you. Me, reading you insulting me twice, shame on me.
>>>Kerplunk!!!!! (The sound of another obnoxious, egocentric,
>>>self-important, prick dropping into my killfile).
>>
>>
>> Bye bye. It's been nice knowing you (NOT!)
>>
>
> I must admit, though, your comments have been creating great humor amongst
> some fellow programmers any myself. I'm may even include some of these
> comments in my class material to show students how dense someone can be.
> Of course, I wouldn't dream of doing it without giving the Great Tony
> Marston full credit.

I'm glad you find this amusing. Just don't be surprised if people end up
laughing at *you* instead.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация