Typing Practice for Coding, and Why the Number Drops
Six of the 29 characters in for (int i = 0; i < n; i++) { need Shift on a US ANSI layout, and that ratio is most of the answer to why a comfortable 80 WPM prose typist works far below that figure inside a source file. Code is slower to type than English, for reasons that have nothing to do with skill.
Where prose speed goes
English is predictable. Common letter pairs live near each other, word endings repeat, and a touch typist is already moving toward the next few characters while reading the current ones. None of that survives contact with an identifier like getUserByEmail followed by (, ) and ;.
Three things change at once. The proportion of characters that require a modifier rises sharply. The sequences are not drawn from a familiar vocabulary, so there is nothing to anticipate. And indentation, brackets and quotes come in pairs that have to be closed, which turns typing into bookkeeping.
Then there is the honest explanation nobody likes. Most of the time spent in an editor is not spent typing. The pauses are the work, and a figure that measures characters per minute measures the least interesting part of writing software.
The characters that leave the home row
On a US ANSI layout the punctuation used by nearly every language sits in three places: the right hand edge of the alphabet block, the digit row, and the bottom row under the right hand.
- Square brackets sit to the right of P, and the braces are the shifted versions of the same two keys.
- The backslash is above Enter, and the vertical bar is its shifted twin.
- Semicolon and apostrophe are on the home row, and colon and double quote need Shift.
- Angle brackets are Shift with comma and full stop, so a generic type or a comparison pulls the hand down and adds a modifier.
That distribution is why the two fingers doing the most work in code are the right little finger and the left little finger, one reaching for punctuation and the other holding Shift. Fatigue in code typing shows up there first, not in the index fingers.
AltGr changes the count again
On a European layout the same line of code needs a third modifier. A German T1 keyboard puts the opening brace on AltGr and 7, and the French AZERTY puts it on AltGr and the 4 key. The brace becomes a two hand movement, or a one hand contortion, on layouts used by a large share of programmers.
That is the practical case for learning where these characters live on the layout in front of you rather than assuming the American positions. The brackets and symbols guide lists the AltGr positions for the main European layouts, and the difference between ISO and ANSI explains why the physical key next to the left Shift exists at all on one of them.
Autocomplete makes the measurement meaningless
Any modern editor closes brackets and quotes for you, completes identifiers after three or four characters, and inserts whole blocks from a snippet. The characters on screen and the keystrokes you produced stop being the same quantity, so words per minute stops describing anything. A typist who accepts a completion after two keys has typed less and produced more.
This is why coding speed tests are hard to interpret. If the test disables completion, it measures raw punctuation work that you would never do unaided. If it allows completion, it partly measures how well you know the editor. Neither figure compares with a WPM measurement taken on prose.
There is a second measurement problem underneath the first. Editors and messaging tools quietly change characters: straight quotes become typographic ones, two hyphens become a dash, and a first letter is capitalised for you. In prose that is helpful. In code it produces a file that looks correct and will not run, and it is the reason experienced developers turn those substitutions off rather than learning to spot them.
What is worth practising
Three things repay attention, and none of them is speed on English text.
The punctuation reaches, one pair at a time, until braces and brackets stop needing a glance. The navigation keys, because moving the cursor is half of editing. And the layout specific combinations, which are pure memory rather than dexterity. If a symbol never appears no matter how you press for it, check the hardware in the keyboard test before rearranging your fingers.
Prose still has a place in this, as the thing that keeps the underlying touch typing honest. Michael Faraday's account of the shadow of a candle flame is a good candidate: 460 characters from the Christmas lectures printed in 1861, one explanation nested inside another, which is about as close as English prose gets to the structure of code. Washington Irving's 499 characters on going into the country, from The Sketch Book of 1820, run on semicolons from the first word to the last. And the Encyclopaedia Britannica of 1911 lists old English standards with a year in brackets and a semicolon between each pair, 315 characters that read almost like a line of configuration. All three are waiting in the typing test, each with its author, year and source on its own page.