The Case of the Cases

Naming is more than a matter of semantics, it's a matter of style

Programmers come up with a lot of names for things. It's an old trope that the two hardest problems in Computer Science are:

  1. Naming
  2. Cache invalidation
  3. Off by one errors

We do so much naming that we not only fret and argue about meaningful, accurate, but concise names that we also argue about the way in which those names are represented. Typical programming languages allow names following the broad convention exhibited by this regular expression:


That's essentially "starts with an alphabetical character or underscore, and continues with zero or more alphanumeric characters, underscores, or dashes"1. That may seem restrictive at first blush, but it actually leaves a fair amount of room for creativity. From this humble rule programmers have developed preferences for different case styles#Multiple-word_identifiers|)

  1. This regular expression is not completely accurate to what many programming languages use, but it's close enough and that's not the point I'm trying to make