I’ve been thinking a lot about how coders use keyboards, given that they weren’t specifically designed for writing code, and yet we are some of the heaviest users around. I ran some frequency analysis on a Drupal installation to see how often certain characters occur in the source code. Specifically, I was looking at non-letter characters (specials and numbers). The code that does this is available as a simple drush command.
The major observation is that the number keys across the top of the keyboard should be inverted, so that SHIFT+NUM
types a number, whereas hitting the key creates the symbol. The symbols are used far more frequently than the numeric counterparts. Especially the ()
parenthesis, the $
and the *
.
Another interesting observation is the underscore occurs 3 times more frequently than the dash.
Here are the full results:
Symbol | Count |
---|---|
SPACE |
2747986 |
' |
486004 |
LF |
430118 |
_ |
238795 |
$ |
234498 |
) |
197119 |
( |
197115 |
= |
156975 |
, |
153406 |
> | 145194 |
/ |
123651 |
; |
104608 |
* |
102685 |
. |
93372 |
- |
87662 |
[ |
74840 |
] |
74831 |
{ |
44167 |
} |
44147 |
: |
22891 |
" |
22035 |
# |
20217 |
@ |
16544 |
1 |
14906 |
& | 11903 |
< | 11178 |
! |
10429 |
2 |
9221 |
? |
5285 |
% |
5058 |
3 |
4684 |
\ |
4317 |
5 |
3921 |
+ |
3620 |
9 |
3559 |
| | 3291 |
4 |
3182 |
6 |
2917 |
7 |
2761 |
8 |
2177 |
? |
442 |
Keyboards just weren’t designed for coders.