Design note: why EK9 checks names
This note goes with Naming Quality Enforcement. EK9 makes three naming checks compile errors: reference ordering (E11026), confusingly similar names (E11030) and non-descriptive names (E11031).
You might be thinking: "My variable names are fine. Why is the compiler complaining?" Fair question. We're not being strict for the sake of it: names that do not say what a value means have been part of real failures.
What the research found
- Lawrie et al. (ICPC 2006, "What's in a Name? A Study of Identifiers"): full-word identifiers were understood better than single letters
- Butler et al. (CSMR 2010, "Exploring the Influence of Identifier Names on Code Quality"): flawed identifier names were associated with code that static analysis found to be of low quality
- Hofmeister et al. (SANER 2017, "Shorter Identifier Names Take Longer to Comprehend"): 72 professional developers found defects about 19% faster when identifiers were words rather than letters or abbreviations
- Aman et al. (2023): of about 117 million pairs of compound variable names in 1,876 Java projects, about a million (0.86%) were confusingly similar in both spelling and meaning
Real-world failures
In each of these, a value's meaning or limits were not carried by its name or type:
- Mars Climate Orbiter (1999): ground software reported thruster impulse in pound-force seconds where newton-seconds were expected, and nothing in the data said which (NASA Mishap Investigation Board, 1999). Spacecraft lost on Mars approach.
- Therac-25 Radiation Therapy Machine (1985-1987): a race condition, and a one-byte counter that wrapped to zero and skipped a safety check, led to six massive overdoses, at least three of them fatal (Leveson & Turner, IEEE Computer, 1993).
- Toyota Unintended Acceleration (Bookout v. Toyota, 2013): the expert review found more than 10,000 global variables in the engine control software (Koopman, 2014).
- Ariane 5 Flight 501 (1996):
converting the horizontal-bias value
BHfrom a 64-bit float to a 16-bit integer overflowed - that conversion was not protected, on an assumption about its range that the code did not state (Inquiry Board report, 1996). The rocket was lost about 40 seconds after lift-off.
The Pattern: in each case the meaning or the limits of a value lived in someone's head, not in the code.
AI coding assistants
With AI coding assistants (Claude, GitHub Copilot and others), meaningful names matter more:
- Fewer tokens: the assistant can understand code from its local context without searching for declarations
- Better code generation: it writes correct code when the purpose of each variable is clear
- Fewer errors: generic names such as
dataanddatmake it easy to reference the wrong variable
Why errors, not warnings
Style checkers can already enforce import order, as a warning that can be configured or suppressed. EK9 makes all three checks errors, for the reason in errors, not warnings: a name you mean to fix "later" ships. Once the compiler is the standard, a team never has to debate naming standards again.