Who Needs Case-Sensitivity in Java?
David Barber asks: "I've just started learning Java, and to my exceptional disappointment it is as case-sensitive as C. I'd like to ask Slashdot readers to make the case for case-sensitivity in a programming language, because I can't see it. Although I've used C on and off since 1976, I also have a history of Fortran, COBOL, PL/I, assembler, and other legacy languages that were never case sensitive (perhaps due to the single case nature of card punches). Today I use modern languages including Visual Basic which preserves case for pleasing appearance, but is not case-sensitive itself (it will correct the case for you in the IDE, which is quite nice). In all my years of programming I have never seen the rationale for making a programming language case sensitive. It simply makes typing it in harder, and mistakes easier, yet we persevere with maintaining it in modern languages like Java. Without making this into a religious war, can someone make the argument of why case-sensitivity in a language is 'a good thing'? And don't confuse this with handling case-sensitive data, which is fine."
Because it makes sense that all symbols are uniquely identified from a set of characters, rather than each symbol being identified by a huge set of names (var, vaR, vAr, vAR, etc). There may be a need for a "canonical name", which is it? All lowercase? All uppercase?
You define a convention and stick to it. Tipically: first word lowercase, other words uppercase first like "thisIsAVariable".
Because it makes dynamic programming and reflection even slower and/or more error-prone (I have experienced this in PHP which is case-insensitive and it bugged the hell out of me [and my program]).
Slower? There's just one more pass involved (an OR in the letters) which you parse anyways. I would hardly call it slower. And that is ONLY in BAD, SELF-WRITING code.
Also please explain how does case insensitivity generate bugs. It actually prevents bugs by understanding that var and Var are actually the same thing!
Because it takes fewer CPU cycles when compiling or scanning source code.
Yeah, and then forcing you to recompile because you wrote FOo instead of Foo by mistake. Big save!
Because some languages use case to indicate a different class of variable (Ruby for instance, issues a warning if you try and change a variable starting with uppercase).
That's a bad language specification. in C you cannot change a variable you declare as constant, obvious, in Ruby it is not so apparent what is constant and what is not.
Because many programmer's text editors are case-sensitive (I know, I know, chicken, egg, etc).
How can a text editor be case sensitive????
Because lowercase/uppercase could be a harder problem if you use a language which allows Unicode symbols (Perl6?). (Is this possible? I have no idea).
There is no difference, basically. And Java supports uppercase functions for unicode in any case...
Because sometimes it actually is useful to have a symbol "ID" and another one "id" in the same symbol table.
It's a very very bad programming practice! Come on you can use id1 and id2...
Because stuff like case and english language is not part of programming, programming is about precision and computers. Introducing ambiguity (whether for the compiler or the programmer) can't be good.
Case sensitivity is way more ambiguous by allowing
bar and Bar to be different variables whereas in English a bar and a Bar are no different.
Because C is case-sensitive, and C is a popular language.
And so?
My Stack Overflow user
In you example the case of the word is only because proper nouns are capitalized in German by convention. The capitalization does not actually help you differentiate between the verb "to fly" and the plural of the insect "a fly" any more than it would in English. What really sets them apart is their position in the sentence.
Your example actually points out how pointless it is to have case sensitivity.
I'm going to cut right to the chase, with language experience like VB and PHP, you're not going to get much sympathy from anyone.
The first reply to you padded this nicely, I'm not going to.
Learn some languages that wouldn't get you laughed at by the majority of programmers in the world. VB is a running joke for any computer science student, much less established programmers.
And PHP's incosistencies within it's own language has it pushed into the background, only those looking for ease of use will bother with PHP. If you're going to be writing anything robust, you're better off scripting it via Perl(just as an example, cgi scripting rules and Perl was the first thing that came to mind).
I program in both VB and PHP
What a joke. You made me laugh so hard there I almost stopped reading your comment.
PS. I got karma to burn. And burn it probably will.