Spelling in code

Av Bergfrid Skaara Dias, Uppdaterad på 13. jan 2022

Spelling mistakes always hit you when you're not expecting it. The harsh reality is that people will judge you on it. Nothing can make you or your company lose credibility more quickly.

But I write code, not literary fiction...

Yet you put your writing in front of other developers. Daily.


repeating mistakes quote


A typo in a code comment might trip up your co-worker reviewing your code. Or perhaps it goes undetected for years until they attempt to refactor or extend the code - after you left the company.

Meanwhile, the comment is propagated to a public API reference where it can affect your company and trip up an unknown number of developers. Did someone say support case?

OK. But let's say the typo was not in a comment, but actual code like a method name, property, or enum? Thanks to your IDE, IntelliSense will propagate your initial mistake like wildfire throughout the code-base. Awesome! Never, ever feed the Mogwai after midnight.




As with all bugs: the earlier you catch it, the cheaper it is to fix it. Who does not like bugs in production? The thrill of patches and hot-fixes. 

But do you realize that once a misspelling is in the released API you have to live with it or break compatibility? Auch!



The solution

  1. Slow down, read the actual words on the screen, and not what your autopilot concludes is there.
  2. Use a code spell checker. (Both for creating and reviewing.)
  3. Get a second pair of eyes. Own your oops'es and do the non-code-related PR change.


Your milage might vary but I'm sure there is a spell checker match for you too.


Personally, I go the VS Code route with Code Spell Checker plus Grammarly. For SuperOffice Docs, we have a shared dictionary in .vscode/settings.json in each repo. You can check it out on GitHub.


SW update illustration


(The covfefe level in my bloodstream is low. Please excuse any typos.)