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.

Read more

Stay Gold, America

We are at an unprecedented point in American history, and I'm concerned we may lose sight of the American Dream.

By Jeff Atwood · · Comments

The Great Filter Comes For Us All

With a 13 billion year head start on evolution, why haven't any other forms of life in the universe contacted us by now? (Arrival is a fantastic movie. Watch it, but don't stop there - read the Story of Your Life novella it was based on

By Jeff Atwood · · Comments

I Fight For The Users

If you haven't been able to keep up with my blistering pace of one blog post per year, I don't blame you. There's a lot going on right now. It's a busy time. But let's pause and take a moment

By Jeff Atwood · · Comments

The 2030 Self-Driving Car Bet

It's my honor to announce that John Carmack and I have initiated a friendly bet of $10,000* to the 501(c)(3) charity of the winner’s choice: By January 1st, 2030, completely autonomous self-driving cars meeting SAE J3016 level 5 will be commercially available for passenger

By Jeff Atwood · · Comments