|
Posted by Tony Marston on 10/05/28 11:55
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:44D105AB.20103@attglobal.net...
> Tony Marston wrote:
>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> news:Cd-dne2roPe8tFLZnZ2dnUVZ_qudnZ2d@comcast.com...
>>
>>>Tony Marston wrote:
>>>
>>>>"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>news:PO-dnZ9kL4xhvFPZnZ2dnUVZ_vKdnZ2d@comcast.com...
>>>>
>>>>
>>>>>Tony Marston wrote:
>>
>>
>> <snip>
>>
>>>>Case sensitivity can lead to unmaintainable code. For example, if there
>>>>is a variable called $foo I expect $Foo and $FOO to mean the same thing,
>>>>not different things. The fact that they are not can lead to unexpected
>>>>results. Programmers who deliberately create different variables with
>>>>the same name but different case are bad programmers, but a *proper*
>>>>language (such as COBOL) removes the possibility for such bad
>>>>programming by ignoring case and treating all the variables as a single
>>>>variable. Any language which deliberately allows programmers to wrte
>>>>unmaintainable code is a bad language. After all, that is why most
>>>>modern languages do not include GOTO because f the problems it can
>>>>cause.
>>>>
>>>
>>>
>>>Yes, I can see where having $foo, $Foo and $FOO be the same thing could
>>>be very confusing. I would never code something like that, and it would
>>>lead to terribly unmaintainable code in a case-insensitive language. I
>>>don't know why anyone would ever want to do that.
>>
>>
>> Having $foo, $Foo and $FOO which mean the same thing in a
>> case-insensitive language does NOT lead to unmaintable code as much as it
>> does in a case sensitive language which makes them separate things. I say
>> his because I have worked for 25+ years with case insensitive languages
>> and seen different case used on different projects, and it has never been
>> a problem.
>>
>
> Using different case to mean the same thing throughout your code is
> completely moronic.
Any programmer who deliberately changes case in a single program is an
idiot. However, there is and never has been a univesal standard for the use
of case. I have worked on many projects with many different teams who have
had totally different ideas:
(a) everything should be in lower case
(b) everything should be in lower case except database table and column
names
(c) everything should be in upper case except database table and column
names
(d) everything should be in lower case except calls to different functions
(e) everything which is part of the core language should be in lower case
while everything defined by the programmer should be in upper case
(f) everything which is part of the core language should be in upper case
while everything defined by the programmer should be in lower case
How many more possibilities are there? The point is that if the lanuage is
insensitive to case there is no reason to pick on any one of those
conventions and make it a rule. Having a rule for the use of case does not
serve any useful purpose, just as the EU rule on the shape of bananas does
not serve any useful pupose. I never had any problem in reading the code
that was written to all those eifferent conventions, and neither did anybody
else. The only *problem* was when some officious twit would point out that a
piece of code did not follow his personal conventions. I would always ask
the question "What problem does it cause?" His answer would always be "None,
but it does not follow the stadards". I would then ask him if he had any
problem reading the code, or if the computer had any problem executing the
code. If his response was "No" then I would inform hm that this was in fact
a non-problem and not wort wasting any time over.
> I learned that even when I was doing case-insensitive languages such as
> FORTRAN and PL/I. Anyone who did that was considered to be either a noob
> or a piss-poor programmer.
People who invent rules which serve no useful purpose other than to have a
rule are far worse (IMHO) than the people who break those stupid rules.
>>
>>>Fortunately, in a case-sensitive language such as PHP, C, Java and many
>>>others, that's not a problem. It makes those languages much more
>>>maintainable.
>>
>>
>> I disagree. Having $foo, $Foo and $FOO mean different things causes more
>> problems than it solves, as does haing different functions called
>> readfile(), readFile() and ReadFile(). Nobody in their right minds would
>> deliebrately write such obfuscated code, therefore the language should
>> protect the programmer from making such a stupid mistake by being
>> insensitive to case. Afetr all, most languages deliberetel do not incude
>> the GOTO verb for that very same reason.
>>
>
> But they are completely different things.
'box', 'Box' and 'BOX' are the same thing in the english language, and they
mean the same thing in case insensitve languages. It is only case sensitive
languages that make it an issue.
> As for your function names - often times readfile() will be a global
> function, while readFile() would be a member of a class. Most programmers
> I know wouldn't use ReadFile().
That is only by programmer convention, it is not a language reqirement.
Besides, PHP does not have such issues:
foobar() is a function
$foobar is a variable
$object->foobar() is a class method
$object-foobar is a class property
PHP does not need to use different mxtures of case to provide the means to
differentiate between those different types.
>>> It's a good thing modern languages have gone beyond the arbitrary
>>> restrictions of older languages like COBOL and FORTRAN.
>>
>>
>> Since when does being insenstive to case become an arbitrary restriction?
>>
>
> It means you can't have readfile() and readFile().
But if the language IS case sensitive then you CAN. readfile(), readFile()
and ReadFile() become totally differet functions. How confusing is that?
>>>And I wouldn't say a language which allows programmers to write
>>>unmaintainable code is a bad language.
>>
>>
>> Then why do most languages not allow the unstructured GOTO? Surely for
>> clever programmers who need such a verb, the fact that it is not allowed
>> is much more of a restriction than case insensitivity?
>>
>
> Actually, most languages DO allow unstructured GOTO. It's just not used
> much in structured languages. There are much better ways of doing it.
But some, like PHP, do not. Even if it were intoduced I would probably avoid
it conflicts with the idea of structured code. But the point is, even in
those languages which provide GOTO its use is *optional* and not a
*requirement*. The use of case started of as an option, but suddenly became
a requirement, and THAT is what I oject to.
> For instance - I don't know how many LOC I've written in C and C++ - both
> of which have the goto statement. Other than maybe when I was just
> learning, I have never used it. Never found a need for it.
>
> But then according to your theory, C, C++, FORTRAN and even your beloved
> COBOL are bad languages because they all allow GOTO in one form or
> another.
A language is not bad because of the options it provides. It is how those
options are used which is the issue. It is possible to write bad code in any
language.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
Navigation:
[Reply to this message]
|