Coding Horror

programming and human factors

The Case For Case Insensitivity

One of the most pernicious problems with C-based languages is that they're case-sensitive. While this decision may have made sense in 1972 when the language was created, one wonders why the sins of Kernighan and Ritchie have been blindly perpetuated for the last thirty-three years.

I realize this is a religious issue. I'm not attempting to change anyone's mind. I'm merely voicing my discontent with the status quo. Thirty plus years later, does case sensitivity still make sense? Julian at OddThinking makes a compelling argument that it doesn't in The Case for Case-Preserving, Case-Insensitivity:

Suppose I declare that "KEANU REEVES interferes with elephants.". Can I claim that I was not libelling the wooden Hollywood actor, purely because I spelt his name in all-caps? Can I claim to a judge that KEANU REEVES was a undeclared identifier and therefore the entire statement was semantically meaningless? Of course not. The English language is flexible enough to recognise that "KEANU" and "Keanu" are the same name. Even mail addressed to "KeAnU rEeVeS" will be delivered to the correct person.

If a computer can also disambiguate this accurately, it should do so too. If the software fails to adapt to the similarity of upper- and lower-case, it leads to frustration.

For me, an example of this frustration appears in both Python and PHP. Each of them have the same killer combination: they are case-sensitive with identifiers, but they are scripting language that do not resolve identifiers at parse-time. I consistently fall for the same traps. A distressingly large percentage of my debugging time is spent correcting mistyped identifiers - often not detected until several minutes into a test run. The most common mistyping I make is incorrect capitalisation. Of those, the two most common capitalisation errors I make are: HOlding DOwn THe SHift KEy TOo LOng, and being inconsistent in CamelCasing the term "fileName" (I never did resolve satisfactorily whether it was one word or two!)

However you feel about case sensitivity, the bottom line has to be this: does it cost you productivity? The answer is undeniably yes, as Scott Hanselman notes:

I spend an hour today debugging a possible problem only to notice that "SignOn" != "Signon".

If I had a nickel for every time Case-Sensitivity or Case-Insensitivity bit me, I'd have like seven or eight bucks. Seriously.

Moral: Know if whatever you're working on cares about Case, and if it does, make a Post-It to remind you and stick it to your monitor.

There's nothing we can do about existing tools and languages that are case sensitive, but we can make sure we don't perpetuate past mistakes. Unless you have extremely compelling reasons to make something case-sensitive, case insensitivity is a much more human being friendly design choice. Designing software that's easier for machines is questionable at best.

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Exchange and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: