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/06/06 08:56

"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.

> 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.

> 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.

> That is the meaning of PROFESSIONAL.

You mean a professional obfuscator.

> 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.

Oh good. Then will not be subjected to any more of your stupud ideas.

>>
>>>> The ability to have 3 different variables called box, Box and BOX
>>>> causes problems.
>>>
>>> See my previous comment.

See my pevios response.

>> 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?

>>>> 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!)

--
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

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