Case-sensitivity is the past trolling us

As a programmer, what I am about to say is close to heresy. The Ministry of Hacker Ethos will likely issue me a steep fine or worse.

In nearly every context, case-sensitivity is computing's past trolling the present. Since it appears to have manifested out of opinion rather than necessity, it could be said case-sensitivity is the worst way that modern technology sucks.

When the 1990s haunt our modern file systems with anachronistic default directory layouts at least we can cite tradition and blame friction. We can whine about just how hard it would be to adapt to a sensible modern layout. Woe is us! Don't ask us to change.

When stagnation keeps us in a color-banded hell, at least we can blame the Curse of Good Enough and the broad population that blissfully accepts 24-bit color or worse.

And even though the retrograde movement in displays through the 2000s was the single most frustrating failure of technology in the modern era, at least 2014 has brought us affordable 4K.

So why are so many things case-sensitive in 2014?

  • File systems.
  • Program variable names.
  • Program function names.
  • Just about everything about programming languages.
  • Database table names.
  • Database column names.
  • Environment variable names.

Worse yet, there are some contexts where the behavior is inconsistent—some things are case-sensitive and others not.

It's not about performance

Let's rule out the only plausible excuse for case-sensitivity immediately.

Java converts a 15-character mixed-case string to lowercase at about 11,600 conversions per millisecond on a single core of my Ivy Bridge CPU:

# Warmup: 3 iterations, 3 s each # Measurement: 3 iterations, 3 s each # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time # Benchmark: com.tsotech.CaseBenchmark.testLowerCase # Warmup Iteration 1: 11201.241 ops/ms # Warmup Iteration 2: 11691.898 ops/ms # Warmup Iteration 3: 11747.565 ops/ms Iteration 1: 11635.761 ops/ms Iteration 2: 11606.102 ops/ms Iteration 3: 11635.587 ops/ms

Even when CPUs were significantly less capable, case-conversion was trivial. And strictly speaking, it's not even necessary to down-convert to lower-case prior to running comparison operations. A comparison can be done with case-awareness.

It's about history

Although it's hard to imagine a CPU so slow that case-conversion cost actually mattered, at some point that must have been the rationale. But Moore's Law probably rendered that rationale obsolete before Moore even gave us his eponymous law.

Now we accept case-sensitivity because computers have always worked this way, so why change now? I'll answer the rhetorical question: because computers aren't a passing fad. I know, they sure seem like one. But let's face it, they are here to stay.

Friction can only justify resistance to change until we teach our successors. We expose our silly legacies when we explain to new users that the file system is case-sensitive because, well, because it just is. Get used to it and like it.

Trolling with case-sensitivity

Case-sensitivity may not be a troll, but it can only serve to troll.

  • Why would you want a directory in your file system to store distinct files named Document, document, DOCUMENT, documenT, and dOcUmeNt? To troll another user of the file system of course!
  • Why would you want your program to have variables named totalCost, TOTALCOST, TotalCost, and totalCOST? Oh, I don't know... Maybe to troll other developers and to obfuscate your code?
  • Why would you want to design a database that has tables named Users, users, and usERs? Because you are some sick, deranged SOB who gets joy in your peers' grief. You are a troll.

I think you can get the point. No one actually wants to have name collisions that vary by case only. But for some reason, we allow for it. And the only other plausible situation where two names would vary only by case is that you made a mistake.

So it's to allow for trolling and to give you an opportunity to make mistakes. Excellent.

Aside: Giving meaning to case

Thanks to historical widespread case-sensitivity, some languages (such as the C lineage) have given meaning to case. So in Java, we know camelCase means a variable name, CamelCase with an initial capital means a class name, and YELLING_CASE means a constant name. So case has meaning, of sorts.

Sure, it's fun to write code like this:

Circle circle = Circle.CIRCLE;

But were I to use a case-insensitive language, I'm pretty sure I'd get comfortable not being able to do so.

I like languages with static typing. But permitting me to refer to a variable named Foo as foo isn't going to turn me into a rogue slinger of fast and loose code. After all, convention and static code analysis tools would likely still encourage me to be case-consistent.

Taking it to the next level

If you disagree that case-sensitivity's only roles are trolling and creating mistakes, perhaps we should escalate this case-sensitivity thing to new domains (pun intended). If case-sensitive file systems and programming environments are sensible, then internet domains should be case-sensitive.

Oh, I'm sorry Joe User, you typed Wikipedia.org? That's a different site than a similarly named popular encyclopedia site, wikipedia.org. You noob.

The domain registrars will absolutely love this plan.

Web site usernames should be case-sensitive, too. No bad would ever come of that.
About this blog