|
|
Down with Case Sensitivity
August 13, 1997
| |
|
Okay, this one's certainly not for everyone. If you're not a programmer, you can
probably move on. If you do pound code for a living, or even use a Unix box, you've run into
this brain-addled old misfeature that keeps getting designed into new development tools --
case sensitivity.
With reasonable systems, it doesn't matter what combination of capital and lowercase letters you use to name something. Even in crusty old DOS, you can type DIR or dir and get your file listing. (DOS smashes case on your filenames, but that's another column.) In Pascal or Visual Basic, Money, MONEY, and money are the same variable. In your word-processor's search function, there's always an option to ignore case, so your word will be found with any combination of cases. Case sensitivity, on the other hand, is a completely different ballgame. Here, cd changes your directory, and CD gets you an error message; ShutdownPort calls your function and ShutDownPort gets you a link error. Here, the system cares greatly about the case of each and every letter you use, and there's only one right way to do it. It wastes your time, as you have to trace down errors and flip letter cases to get things to work. There is no reason for case sensitivity. Why put in case sensitivity at all? Programmer laziness. The only time case sensitivity comes into play is when the program compares one string (usually an input from the user or a file) against another string in a table or memory. As you compare the string character by character, it takes an extra line of code to check that 'A' is the same as 'a'. Leave out this code for efficiency, and your program is now case sensitive (and to hell with the users). Another supposed "advantage" is shorter symbol and command names. (This fits in well the with Unix philosophy of abstruse yet easy-to-type commands: cu, pr, df, dd.) For a symbol of length N, making things case sensitive gives you 2^N as many options: e.g. foo, foO, fOo, fOO, Foo, FoO, FOo, and FOO. This is laziness at the expense of readability. Do you really need two foos, much less eight? Or are you better off choosing another name? Who's responsible for this? IBM is an early culprit. In college I had to code FORTRAN, which required code in all caps, typing lines like DO 100 INDEX = 1, 115 or whatever, on a keyboard without a caps lock key! That's right: shift, type some letters, unshift, type some numbers (or else you get (*(&$, etc. then shift again. To make things even more absurd, the IBM mainframe terminals had a switch that made lowercase letters LOOK like uppercase... but the compiler knew the difference and would still reject your code. Primary culpability goes to the deified Ken and Dennis, for C and UNIX. Those date back to 1969, and have been a pain in the ass for a generation of programmers. Dennis Ritchie has been responsible for hundreds of thousands of wasted hours. Thanks, Dennis. What's worse, computer geeks are still building case sensitivity into otherwise new tools! Presumably they're bellying up to the god of backward compatibility. Part of C++'s ugliness was Bjarne Stroustrup's reluctance to break anyone's 15-year-old shittily written C code. Then Larry Wall built it into Perl... comforts of home for masochistic shell programmers? (Well, it's based on C...) And Java (1995), which is otherwise a decent language, and ditched most of the ugly C++ stuff, managed to keep case sensitivity. Don't worry; you'll have to deal with fooCallback vs. FooCallback vs. fooCallBack well into the next century, Thanks, Bjarne... Larry... James... One "benefit" of case sensitivity is that it outs a certain strain of anal retentive known as the "Case Weenie." The first specimen (so far) is Hrvoje Niksic, answering a question about a popular Unix freeware text editor:
Alexander Craig Russell Here's an unordered collection of quotes about case sensitivity. Some are unattributed, because they were pulled out of convoluted Usenet threads.
"Case sensitivity is a 'bad thing' but it makes your parser easier to
write. Hence C's case sensitivity.
"Mixed case is the problem. Case sensitivity should be outlawed. Plain and simple. IMHO, it is *the* most annoying everyday technical thing on the web, even more annoying than chain-letter spam, and the biggest mistake and demonstration of short-sightedness that web designers/specifiers ever made. Case sensitivity creates vastly more confusion and irritation than any of its so-called benefits which are virtually non-existent." - Fred W. Bach
Case sensitivity! What idiot decided that the case of a variable or method
should be significant? If I ever found a programmer using two distinct
variables, one called Foo and the other called foo, I'd slay him on the spot
and mount his head on a spear next to my letterbox. So why should case be
considered significant in the name of a method?
Rant: "[NT] Lacks text processing commands, i.e., grep, sed, tr, sort, uniq, etc. Fails
to correctly handle case sensitivity. (h == H) which is so stupid because (72 != 104)."
>I'm not going to disagree with this >statement, but I do have a pro-case >sensitive comment to make. Perhaps >the originators of case sensitive >OS's and languages assumed that the >users would have at least some >intelligence. Someone else with an 'intelligence of the users' comment. Basically you're accusing people who want to discuss this of being stupid. You're right, case-sensitivity isn't a big deal. It's just frustrating to have to deal with case typos when the OS could easily eliminate the need. Perhaps the originators of Unix didn't give *one thought* to whether or not the file system should be case-sensitive or not. It just happened. >After all, it's not a very complicated >idea: you type >in the name exactly as you see it. No need to patronize. >I agree that mixed case names can cause >some confusion (one reason why >I chose not to use them) - but the answer >is simple: just don't use them! You have no choice. Files and directories created by package installations might use mixed case. "Let's see, is it Readme.txt or readme.txt this time?" Doing an ls * isn't a big deal, but why should I have to? By ignoring case, the command "cat readme.txt" is unambiguous. Added June 24, 2000: Well-known usability consultant Jakob Nielsen (useit.com) adds some heft to the anti-case-sensitivity argument: do not use MiXeD case text in URLs since people can't remember the difference between upper-case and lower-case characters: all-lowercase URLs are usually preferred (domain names are less of a problem since they are case-insensitive - usability would increase if webservers would ignore case in resolving URLs)... and in the discussion area he adds (emphasis his): What stupidity. We don't need any more case-sensitive computers. It is now several decades since research on human errors proved the prevalence of description errors where people easily confuse two situations that are virtually identical except for a small difference. Early text editors were notorious for binding different commands to, say, u and U, and users frequently issued the wrong command because they confused the two.See his URL as UI Alertbox for the complete article. One of Windows NT's security weaknesses arises from case handling as well: When you modify the "\??" object folder's symbolic link table by substituting a different case (upper versus lower) letter in the table to point to a different device associated with a disk drive alias, it may be possible to bypass typical Windows NT security and allow any user to acquire administrator privileges.The resolution is (drum roll...) installing the latest service pack. |
||