Slashdot Mirror


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

69 of 434 comments (clear)

  1. Uniformity... by samdu · · Score: 2, Funny

    I'm not a programmer, but I would imagine that case-sensitivity would help a great deal with the uniformity of the code.

    1. Re:Uniformity... by mystran · · Score: 3, Insightful
      I am a programmer, and I can tell that case-sensitivity has other benefits too.

      • You don't need to care about the LOCALE settings or other such things. Either something is the same as something else, or it is not. You don't need to care if the compiler actually accepts the source with the right character set.
      • In some cases, it is very useful to be able to use the same identifier in several different cases. One example is having a class "Foobar", an instance of which you can name "foobar", and it's clear what class it belongs, but you still have a separate identifier.
      • This is not directly related to Java, but sometimes you want to have a short identifier for something that's used a lot. Say, you have a global object which talks to an Xserver. If you need to use that in many places, it's nice to name it "X" which is easy to understand, but "x" is a common variable name for short-lived variables, and you don't want it to be the same identifier as "X". Without case-sensitivity, you can't really use one letter globals, because one letter variables are the ones people will be using the most. With case-sensitivy, you can use just the uppercase for globals, and there's no problem. (whether globals are a good idea at all is another subject, and depends on the language and type of program one is writing in/for)

      Case-insensitivity is probably the single most annoying thing with otherwise decent languages such as Scheme. In case-sensitive languages, errors in casing are usually catched by a compiler. With case-insensitive languages it's easy to make errors that are not catched, because the different looking identifiers are actually the same.

      My .02 euros. YMMV.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    2. Re:Uniformity... by Spudley · · Score: 2, Interesting

      Your first point is by far the most important point that you made. Character sets are not uniform (at least in the world of 8 bits per character), even among nations that share most of them, and the upper/lower case equivalents are not always the same between them.

      I also agree with your final point - case sensitivity can be useful in helping to pick up typing errors at compile time.

      But as for the two other points you made...

      The second point is not *quite* as strong. You're right that it does enable you to use similar names in the way you describe, but I have to dispute the need to do that - I hope you comment your code well, because you're certainly not making it any easier to read with that sort of naming scheme.

      And as for the third point... Hmph. If I ever catch anyone using a single-character variable name...! Grrrr. Don't do it. There's absolutely never ever any possible excuse for it (unless you are deliberately obfuscating your code). At least call it "counter" or something similar if you can't come up with anything better.

      Another good point (that has been made elsewhere, I think) is that case sensitivity is a way of trying to enforce consistency in your naming schemes, to benefit programmers reading each others' code - they will know, for example, that all upper case names are declared in the code as static, whereas if it case sensitivity isn't enforced you may type a name in a different case in different places, leaving it unclear to the reader how it's declared without checking back to the header.

      --
      (Spudley Strikes Again!)
    3. Re:Uniformity... by mystran · · Score: 2, Insightful
      Ok, the "X" example might be a bad one (and indeed I generally dislike identifiers that are two short to be descriptive, although in the particular case I had this, an uppercase X could not have possibly meant anything else but the Xserver interfacing object, and it was used extensively, which was actually the fault of the stupid interface, which I had nothing to say about anyway) but at least local one-letter variables are IMHO just fine in many places (that is not the same as "in most places" though). There are valid reasons to call something counter, but no professional programmer would have any trouble reading code where you have say, two coordinates, named "x" and "y" and an iteration variable "i" to iterate over an array.

      I agree that one should think carefully before using short variables, but there are a lot of cases where using longer ones just doesn't make sense. Concrete (although trivial) example (in Scheme):

      (define (pow2 x) (* x x))

      There is simply no reason why this simple function would need a longer variable name than "x". The question is, can I use short variable names, and still write code that others can understand, or should I opt for longer names just for the sake of readability. For a function shorter than say, 5 lines, anybody can read it independent of the length of variable names (as long as you don't deliberately try to fill the lines ofcourse). In fact, it might well be harder to read, were longer names used, because the overall code would be longer. (In Java it often happens that you have to cut a single function call to multiple lines simply because you have to deal with extensively long identifier names. Ofcourse "import" can solve part of this, but then the reader of the code has to know what's imported if you ever have two classes with the same basename, which again is often impossible to prevent, even with base J2SDK.)

      I agree though, that "Foobar" and "foobar" could just as well be made something like "foobar" and "foobar_obj" or what ever naming convention one happens to prefer. Experience has shown that a lot of people seem to like the "turn the first character to lower-case" convention.

      PS. I realize perfectly well that the larger your codebase, and the more you have people working on it, the more descriptive names you need.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    4. Re:Uniformity... by Anonymous Coward · · Score: 2, Insightful
      Hmph. If I ever catch anyone using a single-character variable name...! Grrrr. Don't do it. There's absolutely never ever any possible excuse for it (unless you are deliberately obfuscating your code).

      What if I'm iterating over the elements in a 2D array--say a bitmap? Should I not use x and y for my counters?

      At least call it "counter" or something similar if you can't come up with anything better.

      Why? Giving temporaries/counters descriptive names makes them look important, when they're generally just a detail. Besides that, in languages like C++ and C99, they're generally declared at the point of their use, so there's no question about what they are doing. Even when they're declared far away, we know that names like i are indices. What does counter tell me that I wouldn't already know?

  2. History by Photar · · Score: 4, Funny

    Case sensitivity is just a tradition, with its roots in the Old Testiment.

    --
    He who knows not and knows he knows not is a wise man. He who knows not and knows not he knows not is a fool.
    1. Re:History by Mr.+Slippery · · Score: 5, Interesting
      You can still capitalize your static variables if you like...If you spell a variable "thisIsImportant" in hundreds of places throughout your source code, but in one place spell it "ThisIsImportant" a case sensitive language like Java will consider those two DIFFERENT variables.

      It won't be considered a different variable, it will be considered an undeclared variable. The compliler will choke on it.

      As it should. If people use case convertions to convey information - static variables are capitalized - then the compiler enforcing consistent casing is good. Else in file1.c it's "ThisIsStatic", in file2.c it's "thisisstatic"; Alice, looking a file1.c, knows it's static, while Bob, looking at file2.c, doesn't get that same information. The compiler is merely making you pick a way and stick to it, for the benefit of your fellow humans.

      Should the compilier also ignore misspellings? If "Variable1" appears all over the place and in one place "Variabl1" appears, should the complier auto-correct it to "Variable1"?

      --
      Tom Swiss | the infamous tms | my blog
      You cannot wash away blood with blood
    2. Re:History by msuzio · · Score: 5, Insightful

      I couldn't disagree more. If I read DeviceEntity.java, and it says:

      getDeviceName(customerId)

      I for damn sure don't want to search for the same thing in DeviceServlet.java and be frustrated because it says:

      GETDeviceNAME

      ugh. At the most basic level, this is dumb. If I mistyped the name with incorrect capitalization, it *won't compile*! This is not a subtle error, it would be obvious! So it does not at all lead to errors.

      Case sensitivity means I know a variable, method, whatever, is always going to "look" the same to me when I'm scanning the code or when I type a quick search into vi (/getDeviceName). I don't need my new intern who likes a different set of notation littering my code with GetDeviceName because the compiler lets him get away with it :-).

      I'll agree with you that having both ThisIsImportant and thisisimportant in a module and relying on case-insensitivity to differentiate is probably not a good idea, though...

    3. Re:History by Eneff · · Score: 4, Informative

      :set ic is your friend.

      grep -i is your god.

    4. Re:History by jc42 · · Score: 4, Interesting

      Case sensitivity is just a tradition, with its roots in the Old Testiment.

      Um, funny maybe, but wrong. The Old Testament was written in classical Hebrew (with maybe a bit of Aramaic in some of the later parts), and that alphabet has never had a case distinction.

      Upper/lower case is something that developed only around 1500 years ago, plus or minus a few centuries. It was adopted in the Roman, Greek and Cyrillic alphabets, but that's about it.

      It is useful, as we all learned in grade school. Thus, many managers have aids who are very helpful. But if they have AIDS, it's a serious medical problem.

      One of the reasons that the project I'm working on isn't using Macs is that OSX uses a caseless file system. When we tried porting several important software packages to OSX, they were utter disasters. The symptoms were bizarre and inexplicable, and took forever to hunt down. It turned out to be caused by executables from different packages that had names that differed only in capitalization. Each package had its own convention, so there weren't any collisions on linux and other unix-like systems. But on OSX, there were cases where a component of package X ended up calling a program from package Y, and they both went crazy. We spent so much time finding the problems and fixing them that we decided to just not use OSX except as a UI.

      It's too bad, really. My 17" Powerbook is a really neat tool. I'd like to use it as a real computer. It wouldn't have been much more work for Apple to hide their case insensitivity in runtime libraries, the way it should be done. I really wish they'd done that, rather than breaking the assumptions that all other unix-like systems are built on.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    5. Re:History by JGski · · Score: 3, Insightful
      This sounds too much like the old DOS complaint about the Unix filesystem being case sensitive. Being case-INsensitive would be a far greater flaw.

      For heaven's sake, if you mispelled on case in a program, 99% of the time you'll pick it up in the first compile - problem solved!! Sounds like poor programming discipline and laziness more than anything else.

    6. Re:History by drgnvale · · Score: 2, Funny

      Yes, that's a new feature in OfficeC++2005. And an old feature of INTERLISP. Do What I Mean must have been an awsome tool.

  3. It enforces clean code by choi · · Score: 4, Informative

    It's nice that VB corrects your code in its proprietary IDE, but C/++/Java is used in many different editors/IDEs. The language thus enforces clean code case-wise by being case sensitive.

    --
    Browse Slashdot at Funny+5, everything else -5. The only way to sustain it.
    1. Re:It enforces clean code by ForteTuba · · Score: 2, Insightful

      Must disagree. I can't think of a language that enforces clean code. Can anyone?

    2. Re:It enforces clean code by ForteTuba · · Score: 2, Insightful
      Is thIs clEAn cOdE cAsEwIsE As lOng As It's cOnsIstEnt In All yOUr proGrAm's fIlEs? whAt lAngUAgE wIll hElp wIth thIs? AdA? pAscAl?

      Conventions matter as far as clean code, even at the level of case choices. Language choice doesn't help here, does it?

    3. Re:It enforces clean code by Dr.+Smeegee · · Score: 4, Funny

      Python strongly encourages it. :-)

      Perhaps syntax errors should cause your monitor to explode. I think using deprecated modules already does.

      Let me check....

      Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on Your Mom
      Type "copyright", "credits" or "license" for more information.
      IDLE 0.8 -- press F1 for help
      >>> import fcntl B`LAST!!!!

      AAAIIIGH! Mine EYES!

      Aye.

  4. my reasons....... by Anonymous Coward · · Score: 5, Insightful

    Here are some reasons I just made up (though a couple actually affected my programming).

    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?

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

    Because it takes fewer CPU cycles when compiling or scanning source code.

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

    Because many programmer's text editors are case-sensitive (I know, I know, chicken, egg, etc).

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

    Because sometimes it actually is useful to have a symbol "ID" and another one "id" in the same symbol table.

    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.

    Because C is case-sensitive, and C is a popular language.

    You might want to try PHP5 though, it's a lot like Java but case-insensitive.

    1. Re:my reasons....... by KDan · · Score: 4, Insightful

      Additional reasons:

      Because it makes naming conventions much easier without all sorts of silly prefixes. You'll come to appreciate the fact that, in Java, if a term looks like MyTerm you know it's a class name, if it looks like myTerm you know it's a variable or a method name (recognisable because it's followed by brackets, even when there are no arguments - something which I'm sure you'll be griping about too, right?), if it looks like MY_TERM you know it's a constant...

      Because good programmers aren't bothered by such trifling matters?

      Daniel

      --
      Carpe Diem
    2. Re:my reasons....... by Pogue+Mahone · · Score: 4, Insightful
      Many natural languages have case-sensitivity too - German, for example: fliegen (verb) and Fliegen (noun) are different words.

      But why a big list of reasons FOR case-insensitivity?

      IMHO the question should be turned around to "Why should anyone want case-insensitivity in a language?" (since, as you say, it has to be put there and requires more work in the part of the compiler and/or the compiler writer).

      Then it is up to those who want case-insensitivity to argue their case against the simplest implementation.

      --
      Every bloody emperor has his hand up history's skirt [Peter Hammill/VdGG]
    3. Re:my reasons....... by Shazow · · Score: 2, Interesting
      Because sometimes it actually is useful to have a symbol "ID" and another one "id" in the same symbol table.

      This kind of made me think of my calculus homework which I should be doing right now. Especially for integration, and such. We've variabled "m" and "M". Sure, in a program, it wouldn't be hard to change them to something else like "bigM" and "littleM", but it would sure make the code a lot simpler to read to just have "m" and "M". This is in a case where you're writing a calculus-related program. Eg. a graphing calculator.

      Just a thought.

      - shazow
    4. Re:my reasons....... by smcv · · Score: 5, Insightful
      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.


      That's not ambiguity. Ambiguity is saying one thing which could mean several things; according to your assertion, case-sensitive languages have more than one way (Bar vs bar) to say the same thing.

      English isn't case-insensitive, anyway. When you encounter a capital letter, it's telling you something (that it's the beginning of a sentence, or part of a title, or a proper noun, ...).

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


      There is a huge difference. In the "basic" Roman alphabet (with no accents or anything, as implemented in ASCII) there is a 1-to-1 mapping between upper and lower case; this isn't always true in general.

      For instance, in German there is the "s-set" (which looks a lot like a lower-case beta), which is more or less interchangeable with the character pair "ss". It upper-cases to "SS" (i.e. there is no capital s-set). With that in mind, in a case insensitive Unicode-based language, how many of strasse, stra(s-set)e, STRASSE should be equivalent?

      Once you've finished hard-coding your case comparison rules, what other equivalences are allowed? Is a-acute ("a" with an acute accent, which Slashcode doesn't seem to want to let me post) the same as "a", bearing in mind that both are conventionally upper-cased to A in French, and is the correct answer "if and only if the programmer is French"?

      Being case-sensitive also lets you compare raw byte sequences rather than canonicalising everything, which is no big deal in ASCII (just AND all letters with 0x20) but is intricate and fiddly in Unicode (hence lots of code and memory for all the esoteric rules required).

      On a related note, I think filesystems should also be case-sensitive (like Unix, and unlike Windows and usually Mac OS X); if you want a helpful "ignore small differences" algorithm, it should happen at the user interface level, and it should be possible to override it, like the way you can put double quotes round a non-.txt filename in Notepad to prevent it from appending ".txt".

      Being able to have "Letter.doc" and "letter.doc" in the same directory seems to me to be no more confusing than being able to have "Letter (21 Jan).doc" and "Letter [21 Jan].doc", or even "a_b", and "a__b" (for greater confusion, replace the underscores with spaces, but that wouldn't display properly in Slashcode). It's inconsistent to be sensitive to one small variation, but ignore another, particularly when the main principle of working with computers is "say exactly what you mean".

      (I dislike extension hiding for the same reason; "you can't have two files with the same name, except when they're different types of file"? What sort of a silly rule is that?)
    5. Re:my reasons....... by alonsoac · · Score: 2, Insightful

      There may be a need for a "canonical name", which is it? All lowercase? All uppercase?

      Just pick one (lower/upper) and use that as the canonical name, no problem there.

      Because it takes fewer CPU cycles when compiling or scanning source code.

      why?

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

      Yes but what about all others?

      Because many programmer's text editors are case-sensitive (I know, I know, chicken, egg, etc).

      I doubt that would be important when designing the language.

      Because sometimes it actually is useful to have a symbol "ID" and another one "id" in the same symbol table.

      That doesn't sound like good programming, more like a quick fix for some design error.

      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.

      There is no ambiguity when a canonical name is used.

  5. Java by GuyWithLag · · Score: 5, Interesting

    Take a look at eclipse. Not only is it a subperb IDE that you can pick up within the hour, it has the correct-my-case-for-me feature you asked for.

    Note that in Java case has by convention semantic significance, so that you can discern org.foo.Bar.bleh from org.foo.bar.Bleh.

  6. Namespaces by HalfFlat · · Score: 4, Informative

    One advantage of case-sensitivity of variable names and the like is that it allows ad hoc separations of name spaces.

    For example, it is a common practice in C to use ALLCAPS for macro definitions and alllowercase for variable and function names. If adhered to strictly, it means that there won't be any collisions between variable and macro names.

    It can be convenient in maths heavy code too, where the use of long variable names quickly makes the code hard to read due to excessive line lengths. Being able to use short upper case names for 'big' objects (eg matrices or operators) and short lower case names for 'small' objects such as scalars matches mathematical convention and keeps equations short and readable. Case sensitivity means that there won't be any accidental collisions between the two sets of objects.

    It's certainly not necessary, but it can make life a lot easier. If you don't expect your language to ignore case, then you're unlikely to make case-based errors as a programmer. Especially if you're coming from a mathematical background where 'A' and 'a' rarely refer to the same thing.

    1. Re:Namespaces by IIEFreeMan · · Score: 2, Funny

      Concerning the long variable and the difficulty of writing mathematical code with those. I heavily suggest making use of the refactoring features of your IDE of choice (eclipse hopefully) to rename variables. This way you can write your code with small and obscure variable name and when your code is working you just have to rename your variables to something meaningful :)

  7. OMG by DarkDust · · Score: 4, Funny

    Today I use modern languages including Visual Basic

    Real programmers don't use (Visual) BASIC... at least not after puberty ! ;-)

    1. Re:OMG by lscoughlin · · Score: 4, Insightful

      You're snobbish hatred of a language that's really Not That Bad is indcative of the fact that you are not "A Real Programmer".

      Some very powerful things have been done with visual basic, and the true test of a "Real Programmer" is doing those Powerful Things on time, underbudget, and in Good Working Condition regardless of the environment of choice for the application.

      Notice my hideous but Meaning Laden usage of capitalization. While i don't believe that a capitalization scheme should be enforced by the compiler, i do appreciate having it as a tool to enforce coding standard schemes.

      Smurfy,
      -T

      --
      Old truckers never die, they just get a new peterbilt
  8. CasESEnsivity iS gOod. by noselasd · · Score: 4, Insightful

    When I make a class Person {..} I want the other developers to use
    Person person = new Person(..); not
    person person = new perSon();

    It also becomes a mess when you have some people write
    If(something){
    }
    later you see IF or if.
    Case sensivity preserves sanity and helps enforce coding standard.
    It's a good thing, learn to deal with it.

  9. readability by retards · · Score: 5, Insightful

    In my opinion, case senssitivity allows for more readable code if using long variable or method names .

    For instance:

    MySteadfastObject.doSomeReallyBizarreParsing()

    instead of

    mYSTEadfasoBJEct.DOSomerEAllybizaReparsiNG()

    Emphasizing readability instead of easy-writing is (mostly) a Good Thing (TM).

  10. Java can also correct this with an editor! by BoxedFlame · · Score: 5, Informative

    I strongly recommend you look at IntelliJ's IDEA editor for java. It will do the case fix if you make a mistake.

    Personally I prefer case sensitivity iN ALL LanGUagEs, inCludDinG jAVa bUT AlSo IN eNGlish.

  11. Re:An argument for case-sensitivity by Bluetrust25 · · Score: 5, Interesting
    There was a great post on this subject on comp.lang.c back in 1989 by an academic named Rahul Dhesi:

    Why languages should be case-sensitive:

    People may use |COUNT| and |count| to mean the same thing, but mathematicians don't. In mathematical expressions it's very useful to use case distinctions for related entities. For example,

    Consider a graph G(V,E)

    for each vertex v in V do
    find an edge e in E such that e is incident on v ...

    Since programming languages are meant for use by technical people, and since computer programming and mathematics are so intimately related, it pays to let computer programmers use the same tools that mathematicians do. Not only should programming languages be case-sensitive, but they should allow the use of subscripts, superscripts, and Greek letters too, to make the notation more powerful and more intuitive. Right now we have to go through some trouble to compact mathematical notation to a verbose format just because the computer's character set is so inadequate.

    Link to the original post

    ...And that's why you should sign up for free hosting with aloofhosting.com.

  12. Case-insensitive programming languages? Yuck. by LizardKing · · Score: 4, Informative

    Having had the pleasure of maintaining some Fortran code that was decidedly haphazard when it came to case consistency, all I can say is thank God C and Java are case-sensitive. The only reason languages like Fortran are case-insensitive is because punch cards and many early terminals only had uppercase characters. This enforced a consistency in case, but once terminals with full character sets became common I'm sure legibility of code became an issue.

    Relying on an IDE to correct your sloppy coding by enforcing case consistency is a dubious idea. An IDE can have many positive features - syntax highlighting of errors, automatic indenting - but it shouldn't automatically "fix" errors. Sooner or later the IDE will make the wrong decision about how to fix a programmers syntax error, leading to potentially subtle and hard to find bugs.

    Chris

  13. Mistakes easier? by profet · · Score: 5, Interesting
    It simply makes typing it in harder, and mistakes easier


    easier??? If anything it makes mistakes harder. Java is a very strict language syntax wise and will probably error out on compile if you have a syntax error.

    Now lets think...what would happen if it didn't error out because of case sensitive erors? Wouldn't that make it "easier" to make mistakes?
    1. Re:Mistakes easier? by LizardKing · · Score: 3, Insightful

      Now lets think...what would happen if it didn't error out because of case sensitive erors? Wouldn't that make it "easier" to make mistakes?

      This set me thinking. The guy who posted the article would probably prefer Perl to Java. It is case sensitive, but will let him get away with his sloppy coding practices by simply creating a new variable every time it encounters one which only differentiates from another in case. Then once he's learnt the error of his ways, he'll either return to Java with a greater appreciation of it's reasonably strict syntax, or become a fan of "use strict;" ...

      I remember reading the Jargon File entry on "discipline and bondage" programming languages, which was quite disparaging about them. I found myself in wholehearted disagreement with that attitude, as most programmers I work with need to have discipline imposed on them - coding standards, style checkers and peer review help, but the quality of C code seems to generally better than Perl or C++ simply because the language is much smaller and narrowly defined.

      Chris

  14. SetSlower != SetsLower by Tune · · Score: 5, Insightful

    - SetSlower is a procedure that reduces the speed
    - SetsLower is a function that gets a lower bound in a set of sets

    These are completely unrelated identifiers which are rendered equivalent by BASIC and other case-insensitive languages. It may look like a stupid example, but I've been annoyed on several occasions by misinterpreations of VB code that were caused by case-insensitivity. As a C/C++/Prolog/Haskell/Modula/... -coder I'm probably biased toward liking case-sensitivity, but I can't see why liking case-insensitivity should be objectively better; be more than just a bias.

    --
    What is wanted is not the will to believe, but the will to find out, which is the exact opposite -- Bertrand Russell, "Skeptical Essays", 1928

    Therefore, lets leave this issue as it is until someone comes up with good arguments to choose either one or the other.

  15. Conformance by cookd · · Score: 5, Informative

    I think the biggest reason is style enforcement. The reasoning goes something like this:

    1. Case distinction is room for additional information without increasing the length of the text.
    2. For the additional information to actually be useful, people have to know what the case distinctions mean.
    3. For people to know what the case distinctions mean, there have to be established conventions.
    4. Conventions fall apart very quickly if there is no enforcement or verification.
    5. It is useful to make the compiler perform some of the verification and/or enforcement -- you're much more likely to notice problems immediately if the problem is caught by the compiler rather than an optional LINT tool.

    It is a lot like case sensitivity for English. It really isn't needed, but it sure helps you understand things a lot more easily. You can scan for the start of the next sentence much more quickly if the sentence starts with an uppercase letter and the rest are lowercase. In the same way, you can get a quick sense of what a variable is for by observing its casing, assuming that you are familiar with the casing convention in use.

    English teachers force us to use proper spelling, grammar, casing, and punctuation so we can communicate more clearly. Computer language syntax works the same way. The parser/compiler could do a fine job with a much simpler language, and it doesn't really need to be that strict about syntax checking. ("Error: missing semicolon." If it knows there is a missing semicolon, why can't it just pretend the semicolon is there and go on?) The idea is that stricter syntax checking is useful to the original programmer (many syntax errors are also indicative of logic errors or ambiguity) and also to the maintainer who has to make sense out of the code.

    So the bottom line is that following coding conventions makes your code more readable and your intent more clear. Case sensitivity is one way the compiler helps you maintain your coding conventions.

    --
    Time flies like an arrow. Fruit flies like a banana.
    1. Re:Conformance by SnakeNuts · · Score: 2, Interesting

      I wholeheartedly agree with this point. Speed reading wouldn't be possible without case distinction. It's even easier in german, where every noun has to be captalized, so it's even easier to find the (possible) subject of a sentence. Or when you're trying to find names of persons in text, the fact that they start with capitals is damn useful. I find this the same with Java and C++. It just makes it easier to read.

      --
      Trainee BOFH -- Just give me your username & password
  16. Re:in Holland by tigersha · · Score: 4, Interesting

    This is actually a problem with java because Java states that thos packages must be in the correct directories:

    org.foo.Bar.bleh must be in org/foo/Bar
    org.foo.bar.Bleh must be in org/foo/bar

    This is NOT possible (unless they are in different section of the classpath) in Windows NT because the filesystem is not case-sensitive there. Java's mapping of case-sensitive package names to an underlying filesystem assumes that the filesystem has the same naming conventions that Java uses.

    As far as I know Java can also take Unicode source as input and then the filesystem must also handle that, which would work on NTFS, but not of FAT and probably not on any Unix FS AFAIK.

    --
    The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
  17. So, request them to change it... by ivi · · Score: 2, Interesting

    I understand that the rules of the Java game
    are no longer in Sun's hands to control...

    There's some sort of community-input standards
    committee or working group to which you (or
    any/all of us here, even) can put the Suggestion
    that Java become case-insensitive.

    In fact, why don't we organise a -mass- sugges-
    tion campaign here to do just that.

    A bit like those spontaneous "Let's all meet
    at Macca's on 5th & Spring St (or wherever)"
    that turn out crowds of people, who've never
    even met before... on somebody's whim... ;-)

  18. Easier to read by jgoemat · · Score: 3, Insightful
    Most languages have guidelines to show you how to capitalize identifiers. It is much easier for me to read code that way than if anyone could capitalize differently than the libraries were defined.

    Being case-sensitive AND following capitalization guidelines makes code much easier to read. I don't see any reason to allow the same characters with different capitalization to refer to different variables, but I definitely think any references to a variable or function should be capitalized the same way it is defined and that all keywords should be capitalized consistently.

  19. a cultural thing? by 12dec0de · · Score: 2, Interesting

    I believe that the wish for case insensitivity is a cultural thing, mainly craved for by those for whom english is the native language.

    In more than a few other (human) languages (yes there are others beside english) case conveyes difference in meaning, generally reducing redundancy and often ambiguity when compared to english. Now, those are aspects that should appeal to hackers.

    Also it probably is a windows centric idea to expect things to be case insensitive (or as the original poster pointed out have older roots in primitivity)

    Why would you reduce your name space by 50%?

    mfg lutz

    1. Re:a cultural thing? by platipusrc · · Score: 2

      It would actually be reduced way more than 50%...it would be reduced from hrm, 63^n ([A-Za-z0-9_]) to 37^n ([a-z0-9_]) where n is the length of the identifier and assuming letters and digits used in English and underscore are legal chars.

      --
      And the muscular cyborg German dudes dance with sexy French Canadians
  20. Re:An argument for case-sensitivity by TobascoKid · · Score: 3, Insightful

    Since programming languages are meant for use by technical people, and since computer programming and mathematics are so intimately related, it pays to let computer programmers use the same tools that mathematicians do

    I only partly agree with this statement as I think there are two distinct types of programming - the technical, mathematical type and a far less mathmatical 'data processing' (ie pretty forms for putting data in databases) type of programming.

    With DP case sensitvity just gets in the way - the programmers may not be very technical and any maths used would probably only be complicated by use of the 'same' name for different variables.

    I think VB is definately in the DP category of languages and hence has no need for case sensitivity. As Java is often marketed as a DP language it's case-sensetivity is a serious drawback (at least as far as DP is concerned - in other areas of Java's use it may be usefull).

    Tk

    --
    At some point, somewhere, the entire internet will be found to be illegal.
  21. Re:An argument for case-sensitivity by fredrikj · · Score: 2, Insightful

    they should allow the use of subscripts, superscripts, and Greek letters too, to make the notation more powerful and more intuitive.

    I think this should be handled on the editor side rather than in the language. For example, you'd still name a variable sigma_1 but the editor would display it as a sigma character with subscript index 1. This has a great benefit: it maintains compatibility. People can work on the code even if they only have access to a regular text editor, and it'll be encoding-safe.

    It'd require strict naming conventions, of course, but people should use strict naming anyway.

  22. I hope someone will give a real reason later... by Hakubi_Washu · · Score: 2, Interesting

    Up till now every answer I've seen is either a) Because it's a tradtion, b) Because it's english, c) Because in Mathematics, we distinguish, or, simply, d) Because it's just better.

    With the possible exception of c) these are rubbish. a) Even if it were traditional (which it isn't, as some pointed out -> punch cards), since when do geeks care about old stuff??? A little nostalgia, but die-hard conservatism (in the sense of "to conserve")? b) Yeah, right, "MyObject.GetNumberOfReferences" sure is proper english capitalization... c) If I want to enter a mathematical expression directly as source, then this is a valid point. Notice the "if" however. There are usually some rather dirty hacks you can apply for speed anyway (remember back when multiplying by .5 was much faster than dividing by 2? Some of these still exist...), so I would consider myself a moron to quasi copy'n'paste without thorough rewrite anyway... d) Has never been an acceptable answer. So, what we have up to this point and in my opinion, is a number of prime examples for zealotism an flame-baits...

    OK, now for my POV: I started my programming at around 10 with M$-DOS Batch and QBasic, which I both consider very helpful tools today. Most Windows(TM) PC's I encounter still have QBasic installed and when I need to write a "script" fast on those, knowing these is saving me time I would otherwise spend installing a "real" compiler (So NO Basic-bashing please, it is very helpful and, in it's newer instances reoatively powerful. You have realized that even before "Visual" it was capable of functions, pointers, direct IRQ-addressing, including Assembler, etc.?). Later I learned C,Pascal,Java,Haskell,Prolog,C++, though some only superficially, because I needed those for university. As soon as my "Pascal"-Phase (during school, when my teacher knew nothing but that) I understood one thing: Some languages make writing them appear harder. Semicolons at every lineend, Case-sensitivity, etc. All stuff that the IDE, or even a sophisticated editor, could easily handle themselves, if the the compiler was build for that (So no "the semicolon is given instead of a CR/LF or CR, because of portability, etc."-argument. That is an argument for the _saved_ file, or, even more precise, for the one handed to the compiler...) I was willing to cope with those during C, because the raw power of it made it worth any unpleasancy during writing, but with Pascal it ended being just anoying and a PITA. Java was a final example of artifical stupidity, in my eyes. I understand that it's capitalization rules lead to better readability of the code (which could still be done via IDE-Correction. If a language has commands that only differ in one capitalization, as suggested before, but those command still have 30+ characters, then something is seriously wrong...), but the sheer length of most commands and names in Java is always an eyesore to me. Yes, I know we don't have memory limitations anymore, but I still prefer abbreviations. What's wrong with VARPTR? Is VariablePointer really better? Or is it merely more characters to write? Spoken languages are highly redundant, which is necessary to understand disturbed communication, but when writing code, that is _not_ any issue. Why should I prefer a language that makes me wish for auto-completion of its mile-long commands???

    I hope that my post gives the scale a nudge in the other direction...

    1. Re:I hope someone will give a real reason later... by Twylite · · Score: 2, Insightful
      1. An argument you missed is that upper/lower case is poorly defined for Unicode.
      2. Is VARPTR a Variable Pointer or a Variant Pointer? Is a "variable pointer" something that points to memory that can be changed (a variable), or a changable pointer? Does a "variant pointer" point to a variant variable, or can it be changed to point to different types of variables?
        Meaningful names are long to reduce ambiguity. It shouldn't be necessary to read the code to understand the intent of a variable or function.
      3. Most arguments for case insensitivity are that it is easier or less error prone. If you can't handle getting the case of a name correct, you almost certainly don't have the ability to manage checking parameters and states, or generally doing any of the work involved in writing quality software.
      4. Case sensitivity forces consistency. Interfaces are usually designed and approved by more experienced developers who pay the proper respect to naming ; a case sensitive language prevents the case from being changes, possibly confusing the meaning of the variable or function.
      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:I hope someone will give a real reason later... by YomikoReadman · · Score: 2, Informative
      For everything you've talked about here, not having to worry about it is all well and good. However, what you fail to take into account is that in the real world, where people get paid to write code for a living, and especially in cases where you might not have the same team of coders on a project over it's lifetime who will know what everything is and does. I currently work on a system that has been in use for around 10 years, and I can assure you that most of the original team no longer works for this company, let alone on the project.

      Bottom line is that while you may have a point in cases where the code will only ever be seen by the individual that wrote it in the first place, in cases where the software will go through a full life cycle and eventually become a sustainment system makes readability and understandability an absolute necessity, otherwise you'd never be able to sustain the system with any sense of efficiency.

      I hope that this 'nudged' you into getting a clue about writing good code. Cheers.

      --
      I have no regrets, this is the only path.
      My whole life has been "UNLIMITED BLADE WORKS"
    3. Re:I hope someone will give a real reason later... by mopslik · · Score: 2

      1. That's a Unicode Problem. As I said, that may be interesting for the data handed to the compiler, but not for the IDE.

      If you're comfortable doing everything through your IDE, then fine. Me, I prefer to make quick and dirty hacks via a simple text editor. No fancy case-correction there.

      2. VARPTR is a Variable Pointer. Why shouldn't it be necessary to look something up in the documentary if you don't know your language well?

      I'm very thankful I'll never have to maintain any of your code that you might deploy in a corporate environment. Seriously, one of the reason why names should be intuitive is that you may not be the only one to look at the code. You may know that VAR = variable, but what about everyone else? 100 ambiguous variables later, and that someone's going to be pretty pissed that they have to keep referring back to your data dictionary.

      3. That is an unproofed assumption. Consider the comparison with LaTeX for example. Just because you use a system that automagically formats your text nicely (maybe because you can't), does this imply that you can't write a good text?

      The parent was suggesting that an incapability to handle case correctly is a reflection of a lack of knowledge of language structure, not language content. Your LaTeX example is wrong, in that you should have stated "does this imply that you can't write a text with proper grammar and structure". Very different things.

      4. All-Upper-Case is as consistent. What's your point? I have never confused any variables for functions and vice versa, but that may be because I don't insist on naming things like "ThisIsAThingy" and "ThatIsAThingy"?

      Agaim, your code = your knowledge. It's good if you're the only one who will ever look at the code, but not very useful outside of that. And the "thingy" reference is another good reason why variable names should be descriptive, not abbreviated or cryptic. Besides, all caps is harsher on the eyes. Still, suit yourself...

  23. C does not assume ASCII machine platforms by FriendlySolipsist · · Score: 5, Insightful

    C is carefully designed so that it does not assume that the underlying platform on which it runs is natively using ASCII. A number of relatively obscure features, especially trigraphs, were put into the language specifically to make this work.

    While case-folding is fairly easy in ASCII because upper and lower case letters are exactly one bit distant, it would substantially complicate compilation on other platforms. It is relatively unnatural for the computer to allow case-insensitivity, even in ASCII, and in machines that natively use something other than ASCII it can be quite tedious.

    Having dealt with C implementations that are targeted for machines which are radically different from what most people are used to using, I have a lot of respect for the portability of C. For example, I once worked with a C implementation on an IBM mainframe processor that had no stack, so the C stack had to be synthesized using machine registers and memory conventions, but this worked!

    C was designed to be small AND portable. Java was designed to be, well, portable. No matter how careful you try to be, dropping case-sensitivity from the language would lead to nightmares when trying to achieve portability.

  24. Silly Troll... by jonadab · · Score: 2, Informative

    > Without making this into a religious war, can someone make the argument
    > of why case-sensitivity in a language is 'a good thing'?

    If you look up "holy war" online and skip over anything having to do with
    real-world non-computer-geek religions, you'll find the following classic
    examples of holy war materiel: Emacs vs vi, big-endian vs little-endian,
    *nix vs non-*nix, CISC vs RISC, and case-sensitive vs case-insensitive.

    In short, it's highly a matter of taste. Some people even like to have
    case-sensitivity in their filesystems. (Personally, I dislike that and
    think that should be optionally possible to turn it off in certain
    directory trees (particularly, /home).)

    Personally, I don't mind case-sensitivity in a language, generally. Perl
    is very much case-sensitive, as is elisp, and neither has ever troubled me.
    The only time case-sensitivity in a language has really bothered me is in
    Inform -- but that was because of the incompatible _changes_ in the case
    sensitivity from Inform5 to Inform6, which caused a lot of my code to break.
    Now, that said, it is also possible for a language which is case-sensitive
    to go far wrong in its use of case by being inconsistent in a way that will
    leave you unsure which case is correct sometimes. For example, if a lot of
    the ready-made modules/libraries/whatever that you use are not consistent
    with one another in their use of case, that would be very bad. In elisp and
    Perl, I have not generally found that to be the case. I can't speak for
    Java; my attempts to learn Java have largely ended with "Ew, it's like C++".

    --
    Cut that out, or I will ship you to Norilsk in a box.
  25. All of the arguments in one post by zero_offset · · Score: 4, Interesting
    Having fought this war several times before (I agree that case sensitivity is an unnecessary pain in the ass), and I believe I can sum up most of the likely responses in one big post.

    1. History -- Argument: Lots of languages are case sensitive, and people seem to be capable of dealing with it, so this is a non-issue. Response: The problem is, of course, that this response completely avoids making a point relevant to the argument.

    2a. Readability -- Argument: Forcing people to type "if" instead of "IF", "If" or god forbid, "iF" will enhance readability. Response: I personally feel that all-lowercase individual words are a lot easier to read than leading capitals or all-uppercase, but this is only a solution for the predefined keywords of a language, and really fails to address the question of case *sensitivity* to case in programmer-defined names.

    2b. Readability -- Argument: If I define myCleverMethod, I don't want to debug code littered with MYcleVERMetHOD. Response: Somebody inevitably posts some variation on this, and I can't imagine why they bother. What kind of idiot would bother with such screwy capitalization?

    3. Flexibility -- Argument: Case sensitivity allows you to use the same multi-word phrase for two unrelated things when they both happen to require the same spelling. Response: I actually had somebody use the examples CarPass and CarpAss to illustrate the flexibility of case sensitivity (on the pre-release C# mailing list at Don Box's develop.com). To date I have not seen an example of this which is even remotely defensible. Elsewhere in this /. discussion someone posted SetsLow and SetSlow, which sounds slightly more realistic, but it's still reaching. Somebody show me one where the "obvious" names are significantly better than simply choosing an alternative.

    4a. Parsing -- Argument: The main reason case sensitivity exists is because uppercase and lowercase letters really are different things to a computer. Response: This mattered a lot in the old days of computing (which also yielded the terseness we see in languages like C). The machine on my desktop has a 3GHz CPU and 1GB of RAM. It can compile tens of thousands of lines of code in a matter of seconds. Although it can probably be argued that non-ASCII platforms would have a harder time performing this conversion, I'd also point out that databases and other applications in those same environments perform case conversions quite easily on those same platforms. I do not consider this a valid argument.

    4b. Parsing -- Response: The standard parsing argument could be extended in equally ridiculous directions. With the considerable power of modern desktop computers, we can do all sorts of things with text. Why not treat red, blue, and boldface text as separate characters, too?

    5. Mathematics -- Argument: Mathematicians regularly represent different variables and other elements which are differentiated only by notational case. Response: Due to the incredibly tiny fraction of programmers who are also mathematicians writing mathematical code, I believe this argument is irrelevant. It's probably one of the more interesting arguments, but frankly it's always annoyed me in mathematics, too. :)

    6. Constants and Classes -- Argument: Traditionally, many languages define constants using names which are all-uppercase, and more recently classes are often defined using names which are captialized. Response: This one always annoys me. Usually the same person is saying that the capitalization differences assist in the readability of the code moments after they've made the argument that capitalization should be inflexible for the sake of readability! There is nothing about case-insensitivity which would prevent this practice. I do it myself when I use case-insensitive languages. What it would prevent is using the same WORD to mean two different things. If that isn't just begging to introduce readability errors, I can't imagine what is. Nothing about case-insensitivity prevents peopl

    --

    Slashdot quality declines as the number of hot grits posts decreases. - Provolt's Law, Apr-09-2005

  26. Re:I was thinking the same thing... by n9hmg · · Score: 2, Informative

    Ok, here's the solution for all the case-challenged intellects out there, who can't seem to grasp that the ability to use both cases does not imply the requirement to do so:
    Program with the capslock key on. Occasionally run your code through "tr 'a-z' 'A-Z' and diff that against your existing file, to resolve conflicts. Fix the translated file and work from that, and quit complaining about the fact that a language has features you don't use. There're plenty of languages that were developed on baudot teletypes, so use one of them, if it's such a hardship.
    We're using numbers to represent letters, and the only thing relating an uppercase character to its lowercase counterpart is the ascii translation table. If someone is using a DBCS input method for variable names, do you really think the compiler should anglicize the bytes? Or, perhaps you'd like the extra complexity of having to specify localization? Sure, it can be done, but why write around the preferences of fools?

  27. More one-letter Variables! by Ba3r · · Score: 5, Funny

    With Case Sensitivity, I can have 52 one letter variables, not 26!

  28. The answer is in the question... by ykoehler · · Score: 3, Interesting


    Why is Visual BASIC trying to preserve the case-sensitivity? If you think as you said that it is only to please the eye, think again.

    The BASIC language was to introduce people to programming and is a language that try to remove rules to allow faster results (faster != better all the time...).

    If they preserve case it probably is because people requested it and if people requested it probably has something to do more the need to have consistency.

    In english, why do we put name with a Capital in front? Or why to sentence required to be uppercase? Because case, like a letter create different pattern which may be easily recognized by the brain and treated in a different way.

  29. Learn another (natural) language and you'll know by lokedhs · · Score: 3, Insightful
    In english, the concept of upper and lower case is quite simple. Every uppercase letter has a lower case version, and this rule is true the other way around.

    Speakers of other languages are not quite as fortunate. I'll try to explain, but the horrible lack of Unicode slashdot coupled with the extremely stupid character filter will make this slightly more difficult than it should be.

    German, for example, has a letter which is basically a "double s". This letter only has a lower case form, in upper case, this letter becomes "SS". However, "SS" in lower case becomes "ss", not "double s".

    French has a character which is a lower case "e" with two dots above. The upper case form of this letter is the normal "E" in france, but in french canada this letter becomes an upper case "E" with two dots.

    There are other languages which has characters that only exist in upper case or lower case forms.

    Do you realise just how complex the casing rules becomes when you have to take these things into consideration? Keep in mind that Java supports all unicode characters in symbols.

    The exact same argument can be used when explaining why the oeprating system kernel shouuld not have case-insignificant file names. This is a localisation issue and neither your java compiler nor the operating system kernel should have to worry about what locale you have in order to determine how a certain string of characters should be interpreted. (yes, encoding issues always creeps in, but that's on a different level).

    Just think about it. Your program compiles properly if you select "french france" when you log in, but fails when you use "french canada".

    Don't you think it's easier just to specify that symbols are case significant?

  30. Programs are data by scruffy · · Score: 2, Interesting
    And don't confuse this with handling case-sensitive data, which is fine.

    No, you are confused. Programs are data, too. At least they are data to compilers.

    Consider a regular expression. Is it a program or is it data? Many filtering programs will load in a bunch of filters written as regular expressions. Which parts should be case-sensitive or case-insensitive? It turns out that it is relatively standard for lower and upper-case pattern elements to have opposite meanings, e.g., \w matching any alphanumeric character, and \W matching any non-alphanumeric character.

    Interestingly though, LISP historically has been both case-insensitive and a language that allows programs to be easily treated as data. I programmed in LISP for a long time, and the case-insensitivity wasn't any big deal. You'll get used to case-sensitivity and learn to take advantage of it.

  31. ExpertsExchange != ExpertSexChange by CharAznable · · Score: 2, Funny

    Thus, case sensitivity is a Good Thing.

    --
    The perfect sig is a lot like silence, only louder
  32. Re:in Holland by Rip!ey · · Score: 2, Insightful

    This is actually a problem with java ...

    This is NOT possible in Windows NT ...


    Some might argue that this is a problem with Windows, not Java.

  33. English rules by jtheory · · Score: 4, Funny

    In english, the concept of upper and lower case is quite simple.

    I think you mean:
    In English, the concept ...

    (Sorry, couldn't resist...)

    --
    There are only 10 types of people: those who understand decimal, those who don't, and, uh, 8 other types I forget.
  34. CAPS-LOCK ON, FULL SPEED AHEAD by XaosTX · · Score: 3, Funny

    GEE, LET ME THINK...WHY DO WE NEED CASE-SENSITIVITY IN A LANGUAGE? COULD IT BE BECAUSE CASE CAN ENCODE ADDITIONAL MEANING? Take the above paragraph as an example. Was I yelling? Sure seems like it. In the same way, additional meaning can be encoded within a programming language by using that little Shift button on your keyboard.

  35. Who needs correct spelling in Spanish? by morcheeba · · Score: 3, Funny

    I've just started learning Spanish, and to my exceptional disappointment it is as spelling-sensitive as English. I'd like to ask Slashdot readers to make the case for spelling-sensitivity in a written language, because I can't see it. Although I've used English on and off since 1976, I also have a history of Egyptian heiroglyphics, runatic symbols, street signs, pictographs, and other legacy languages that were never spelling sensitive (perhaps due to the lack of letters in these symbolic languagues). Today I use modern languages including American Sign Language which preserves spelling for pleasing appearance, but is not spelling-sensitive itself (it will correct the case for you in the Word, which is quite nice). In all my years of speaking I have never seen the rationale for making a language spelling sensitive. It simply makes typing it in harder, and mistakes easier, yet we persevere with maintaining it in modern languages like Spanish. Without making this into a religious war, can someone make the argument of why spelling-sensitivity in a language is 'a good thing'? And don't confuse this with handling spelling-sensitive surnames, which is fine."

  36. Garbage by TheRealMindChild · · Score: 2, Interesting

    I see SO MANY comments along the lines of: "A real programming language is case sensitive" or "A real programmer uses case properly" Well you know what? Im a real programmer, and I think case sensitivity is retarded. How ambiguous is it if you use a couple of variables, MyName and MYNAME? Quite. Today's geeks seem to be more inclined to jam something into 1 line of perl instead of making their code readable and maintainable, and the ignorant comments on here prove just that. Plain and simple, it is BAD practice to have any variables named the same, even with varying case. It's a different variable, it has got a different purpose, therefore its declaration should be unique. Having to deal with common typing case mistakes is one thing that reduces productivity. If you ABSOLUTELY NEED to have variables of the same name, use namespaces. Thats what they are there for.

    --

    "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  37. Re:An argument for case-sensitivity by dubl-u · · Score: 4, Insightful

    With DP case sensitvity just gets in the way - the programmers may not be very technical and any maths used would probably only be complicated by use of the 'same' name for different variables. [...] As Java is often marketed as a DP language it's case-sensetivity is a serious drawback (at least as far as DP is concerned - in other areas of Java's use it may be usefull).

    I think a better distinction is between scripting languages and programming languages. Scripting languages are meant for short bits of coding by non-experts. Programming languages are meant for large bases of code built by professionals.

    It's a continuum, of course; no language is used for only one of those. But Java is clearly intended to be pretty far towards the professional end of the spectrum. Non-experts working on small projects should pick a language better suited to their needs; Java will seem to them to be balky and annoying.

    And as an aside: non-experts should stick to small projects. I think the huge danger with scripting languages (in which category I'd include things like pre-dot-net VB) is that although they are great getting non-programmers into doing a little programming, they let people get away with a lot of stuff that is dangerous on larger scales.

    It's as if a guy who successfully changed a lightswitch in his house grabbed his trusty screwdriver and tried to tackle wiring a 500-rack server facility. He might get some stuff working, but it would be flaky, dangerous, and impossible to maintain. Just like so many code bases I've seen put together by "not very technical" programmers.

  38. Missing the point by yishai · · Score: 2, Insightful
    A lot of responses to this miss the point entirely. Case sensitivity has a serious cost: Bugs. And most notably, debugging time. Countless hours of programmer time have been wasted due to case sensitivity. It makes very hard to find bugs.

    Consider this snippet of java code:

    try {
    doSomething();
    } catch (TransactionRolledbackException e) {
    recover();
    }
    And yet you see TransactionRolledBackException propagating to a higher level. You have looked at the code and swear you are catching it. Oops, missed that upper case B.

    Arguments that you can do something like this:

    Object object = new Object();
    are irrelevant. This is also perfectly legal in java:
    Object Object = new Object();
    Case sensitivity does nothing to enforce preferred conventions, and actually enforces unreadable code.

    Would I like to read code that says System.arrayCopy(...), or Color.BLACK ? Sure I would, but that wouldn't compile. Case sensitivity enforces the wrong thing (literal consistency) rather than convention (conceptual consistency).

    Would I like to rename that class which someone called subProductPanel to SubProductPanel? Sure I would, but that would involve changing the 15 classes that reference it, not to mention the file name, which would confuse CVS on windows clients terribly.

    So I am stuck with my subProductPanel class name without more effort that it is worth to fix, because of case sensitivity. If everything was case insensitive, then I would be able to change it easily.

    As for portability, case sensitive and case insensitive are incompatible and equally create portability problems. Windows having a case insensitive file system causes limitations in Java's portability because Java considers MyClass and myClass to be two separate names needing two separate files. Windows will not support that. So Java code that runs on Linux will not work on Windows, and vice-versa (think about code which reads from the file system).

    Bottom line:

    Case sensitivity creates an environment condusive to hard-to-find bugs because people aren't case sensitive. They may notice case when it is out of place, but not normally.(sOMEtHINgouToFplACE vs. somethingOutOfPlace will be noticed. Not, however someThingOutOfPlace or SomethingOutOfPlace and only programmers consider SOMETHINGOUTOFPLACE different).

    A case sensitive environment enforces only the non-use of conventions. A case insensitive environment lets you use the convention even if the author of the API forgot to.

    As for BasicSend vs. BasicsEnd, that is an argument to use something other than case to differentiate words, not just hoping that people notice the difference. Wouldn't Basic_Send and Basics_End be much better?

    As for differences in how languages handle case insensitivity, String.toLowerCase() figures it out, so would the computer language. You establish rules and stick to them. Will a language which targets the English speaking get all other languages right (the way most speakers of that language would intuit)? Probably not. That doesn't mean that the target audience has to spend thousands of hours chasing down unnecessarily hard to find bugs.

  39. Case for insensitivity by stanmann · · Score: 2, Funny

    Most programmers are male, Many are ADD, some are dsylexic. Most can type almsot as fast as they think. MY pinkie raNdomly pushes shift without being asked TO. ANd sometimes doesn't release it when asked to. I Alsso sometimese accidentally double letters. Case insensitivity with a case aware IDE allows me to focus on What the Foo I am doing with BAR without worring about which foo I baR. I tend to Trust my IDE to let me know during code review... before I complie that I didn't put those letters in the write order. I use a modified version of MS's Hugarian notation for variables so that clsFOO is different from szfoo and clsszfoo is something else entirely...

    --
    Food not Bombs is a nice platitude but it breaks down when you notice that the Bombees are usually well fed
  40. Because Java uses Unicode by GCP · · Score: 2, Insightful

    ASCII has a relatively simple, consistent mapping from lower- to uppercase and vice versa. Letters all have a single upper-lower 1:1 pair, while all others are caseless and upper and lower are the same. It's a simple map.

    But ASCII is obsolete. Java doesn't use it, even for variable names. When you go beyond ASCII, you have many different case maps to choose from. Different cultures have different case equivalency rules, some of which are rather complicated. And then, as others have mentioned, there are the coding conventions that make use of casing to make distinctions, but these conventions ride on top of the cultural conventions regarding which distinctions matter. (I don't want to get into the details, but what one man considers a single letter another might consider to be two, for example.)

    You can avoid all of these thorny cultural disagreements by either limiting all identifiers to ASCII with its single equivalency map, or by just making the rule that identifiers are the same if and only if they are composed of the same sequence of characters and avoiding the issues of equivalency maps altogether. (Until you get to normalization, which is another can of worms....)

    Since Java allows a much wider range of characters in its identifiers than the puny ASCII character set, it chose the second option: ignore equivalency maps and declare that "if it's not the same, it's different".

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  41. Re:I was thinking the same thing... by Frizzle+Fry · · Score: 2, Informative
    so you have to remember which word is capitalized

    No you don't. The coding standards say that initial letters are capitalized for all words except the first. If you know that rule, there is nothing to remember for each function name. Unless of course, you're not following the coding standard, but I imagine that you are since your gripe is with that standard.
    --
    I'd rather be lucky than good.
  42. Re:An argument for case-sensitivity by neilio · · Score: 2, Insightful

    IMHO it helps enforce coding consistency. Very helpful when writing and debugging code. If you wrote a program using hungarian notation and say use:
    String arrMyArray[5]; //my java is rusty

    It is easier if case sensitivity won't let the lazy type arrmyarray[x]. It almost disappears in the text. When debugging and examining code, consistent variable names help you pick stuff out of the fray, visually, easier.

    I am a huge fan of languages such as C and java which are fast, strongly typed, and rigidly enforce consistency in referencing variables.

    Slop=hard to maintain.

    Imagine reading a book where the case is all whacked. It wouldn't be as easy.

    neilio

  43. One Artgument for Case INsensitivity by cookiepus · · Score: 3, Interesting

    As someone with history of Java, who does C now, I instinctively want case sensitivity. If I did not have to use case, I still would. Ie, all my variables would be myStruct even if I could reffer to it as mySTRUCT and MYstrucT and whatever. So lack of compiler enforced case checking wouldn't make code less readable.

    One benefit I would get out of C being case INsensitive is this:

    I often link fortran and C objects together. For those of you who don't know, fortran is case insensitive, but when it is compiled, all function symbols are compiled as lower case with an _ attached to the end. So if in my fortran file I have a subroutine called MYstupidFORTRANroutine, and I wanted to call it from C, I would need to extern mystupidfortransubroutine_ (lowercase with the attached ampersand)

    Which is fine.

    Now here's the problem. When I do a function call from Fortran (something like CaLL MyStuPiDcSUBrouTINE) the compiled code actually calls a function mystupidcsubroutine_ . That means that in C, I must name my function mystupidcsubroutine_ (all lower case with the ampersand) in order to have it callable from fortran.

    Now, life would be simpler if all the compiled symbols became standard and case insensitive accross all languages. That would allow us to link objects together and have functions callable from one language to another. Since this one case insensitive name would have to be standardized (eg: always make it lowercase with _) then the language would have to be case insensitive as well, because otherwise myFunction and MYFUNCTION would be different symbols but must share a common name - impossible.

    This isn't really a super-strong argument for case insensitivity, but it's a possible one. Personally, I would still keep my code consistent whether I had to or not (when I write fortran code I do it even though I don't have to. it bothers me to see fortran code SHOUTING AT ME) And I would not agree that having variables called FOO Foo and foo in your code refering to different things isn't too good. Though I guess a function taking a string argument "file" and opening the global file pointer FILE to that "file" is kinda reasonable.