
Typing for Programmers: Brackets, Symbols and Code
Programmers like to say that typing speed does not matter, because most of the job is thinking. That is half true. Nobody writes code at 100 words per minute for hours. But if you have to look down to find a curly bracket, or you mistype every third underscore, the keyboard interrupts you dozens of times an hour. The goal for a programmer is not a high score. It is to stop noticing the keyboard at all.
Why code is harder than prose
A typing test made of ordinary sentences uses the letter keys, the space bar and a little punctuation. Code is different.
- Symbols everywhere. Brackets, braces, semicolons, equals signs, quotes, slashes and pipes appear on almost every line. Most of them sit at the edges of the keyboard and many need Shift.
- Unusual words. Names such as
getUserByIdormax_retry_countmix capitals, underscores and abbreviations that your fingers have never practised as units. - Numbers. Indexes, sizes and constants bring the number row into regular use.
- Precision. In an email, a typo is embarrassing. In code, a single wrong character stops the program from running.
This is why someone who types prose at 70 WPM can find that code comes out at half that.
Which finger types which symbol
On a US keyboard, nearly all the programming symbols belong to the right little finger and the number row. Knowing the assignments removes most of the hunting.
- Right little finger: semicolon and colon, apostrophe and quotation mark, square brackets and braces, backslash and pipe, slash and question mark, hyphen and underscore, equals and plus.
- Right ring finger: full stop and greater than sign, 9 and the opening parenthesis.
- Right middle finger: comma and less than sign, 8 and the asterisk.
- Right little finger again: 0 and the closing parenthesis.
- Left hand, number row: 1 with !, 2 with @, 3 with #, 4 with $, 5 with %. The right index finger takes 6 with ^ and 7 with &.
- Left little finger: the backtick and tilde, at the top left.
The right little finger does a lot of work, and it is the weakest finger. Let the whole hand move slightly towards the far keys instead of stretching the finger alone, then return to the home row.
For shifted symbols, hold Shift with the opposite hand. Opening a brace is right little finger on the key and left little finger on Shift. Typing both with one hand twists the wrist and is slower.
If your keyboard is not a US layout
Most programming languages were designed around the US keyboard, where brackets and braces are easy to reach. On German, French, Spanish, Portuguese and many other layouts, braces, square brackets, the backslash and the pipe need the AltGr key, sometimes in awkward combinations.
You have two reasonable choices. One is to learn the AltGr combinations properly, as deliberate practice, until they are automatic. The other is to add the US layout and switch to it for coding, keeping your own layout for writing. Many programmers outside the United States do the second. It takes a week or two to adjust and makes every tutorial and shortcut match your keys. Either choice is fine. Guessing each time is what costs you.
Let the editor type for you
A good part of programming speed comes from typing less.
- Automatic closing brackets. Most editors insert the closing bracket or quote when you type the opening one. Learn how yours behaves, so you do not type the closing character twice.
- Completion. Accepting a suggested name with Tab is faster and more accurate than typing a long identifier.
- Snippets. A short abbreviation that expands into a loop or function skeleton saves many keystrokes and many typos.
- Multiple cursors and renaming. Changing a name in ten places at once beats retyping it ten times.
- Navigation shortcuts. Jumping by word, to a line number, to a file or to a definition keeps your hands on the keyboard.
Touch typing still matters here, because all of these are triggered from the keyboard. The less you look down, the more they help.
How to practise
Ordinary typing tests will not train the symbols. Practise on the material you really type.
- Use real code. Paste a function from your own project, or from an open source project in your language, into a custom practice tool and type it exactly, including indentation symbols and punctuation.
- Drill the pairs. Type short lines of the combinations you use most:
() => {},[],{},!=,==,&&,||,->,::,</>. A few minutes a day is enough. - Practise names. Type lists of camelCase and snake_case identifiers. The Shift and underscore movements are the ones that trip people.
- Go for accuracy. In code, a correction costs more than in prose, because you often notice it only when something fails. Aim for 97 percent or better before pushing speed.
What speed is good enough?
There is no required number. As a practical guide, if you type ordinary text at 50 to 60 WPM without looking and can type symbols without hunting, the keyboard is no longer holding you back. Beyond that, time is better spent on your editor, your shortcuts and the problem you are solving.
Look after your hands
Programming means long sessions with heavy use of the little fingers and the modifier keys. Keep your wrists level, take short breaks and avoid stretching one hand to hold a modifier and a far key together. If the right little finger aches, slow down and move the hand more. Small habits here matter more over a career than any amount of speed.