|
Posted by Colin Fine on 01/04/06 01:59
Wayne wrote:
> On Sun, 1 Jan 2006 10:49:17 -0000, "Tony Marston"
> <tony@NOSPAM.demon.co.uk> wrote:
>
>
>>>Not in C, C++, Java, etc. they aren't. And we're talking COMPUTER
>>>languages here - not HUMAN languages. Or can't you figure out the
>>>difference?
>>
>>But the point of this argument is that variable names such as 'box', 'Box'
>>and 'BOX' should all indicate the same variable, not different variables. If
>>you really want to have three different boxes you would use names such as
>>'box1', 'box2' and 'box3' to avoid any confusion.
>
>
> I'd like to point again (although not necessarily for you Tony, more
> for Colin) that Human programmers, in case-sensitive languages, do use
> case to distinquish meaning.
>
> In Java, classes begin with an uppercase letter and
> variables/functions do not. And "box" and "Box" are commonly used
> together. In C, all capitals signals constants or types and BOX and
> box are commonly used together.
>
> Humans do these sorts of things. I'm not saying it's good or bad --
> I'm just saying that's how it's done.
>
I don't deny it. I'm not saying that humans don't or can't do these things.
Case distinction is but one of the many distinctions and pernickity
rules that we have to learn when we learn to program in a language or
system that uses it. We can of course learn it, just as we can learn
that letter 'o' must be distinguished from zero. And because it's there,
some people make use of it.
But, to reiterate and expand my previous argument, the problem comes
when we make up the letters into words - which, most of the time we do,
when we are naming things - variables, classes, files.
Those of us who grew up with English (and other European languages which
have case in their alphabets) are used to thinking of the word 'box' as
being the same word whether written 'BOX' 'box', 'Box' or even 'bOX'.
It's not that we can't distinguish these, but we don't normally need to,
and more significantly, we don't have very convenient ways of expressing
the distinction.
This means first that (as I said before) if we need to dictate a line of
code over the phone, we need in principle to express the case of every
letter. There are ways of shortening this of course, and if there is a
relevant convention (such initial cap, or camel case) we may be able to
express it relatively easily, provided the hearer knows the convention.
But actually I think there is a more severe issue, to do with
remembering and comparing names. The variable I was just using in that
other routine - was it called 'textbox', 'TextBox' or 'textBox'? For me
anyway, remembering a name made up of ordinary words or familiar
abbreviations for them is trivial (I probably vocalise it). But
remembering the case, if it is not all a single case, is not trivial -
it takes more effort and is prone to error. I can't believe that I am
the only one to have this experience.
It is true, of course, that conventions for use of case assist in this.
If I know that class names will always have an initial capital, I don't
have to remember this for each name. But I find that in practice there
are lots of different conventions and I'm often switching from one to
another as I work on different scripts written by different people at
different times, even on the same system. A particular bugbear (because
particularly difficult to remember) is when using CamelCase, are little
words in the middle of names capitalised or not? (i.e. is it WriteToFile
or WritetoFile?) Again you can, and probably should, have a convention,
but what if there are different conventions?
Somebody will probably come back and say, well you should have
conventions on this and then you won't have a problem. And I say, yes,
but if the language weren't case sensitive in the first place, there
wouldn't be a problem.
Despite Jerry's insistence, I have yet to see an argument in favour of
case sensitivity that doesn't come down to either 'everybody uses it' or
'for consistency with XXX system that uses it'. I recognise that as a
practical fact it is here to stay, and yes, I use it. But that doesn't
stop me from arguing its demerits, and I resent being patronised and
insulted for doing so (by Jerry, rather than by you Wayne).
Colin
Navigation:
[Reply to this message]
|