Live data from Hacker News

Most Pressed Keys and Programming Syntaxes

mahdiyusuf.com

41–50 of 75 posts

Re: Most Pressed Keys and Programming Syntaxes

#41
I would like to see what a heatmap generated from a "real" typing session would look like (with a keylogger). You could see the influence of the editor as well.

Since these are generated offline, the keyboard heatmaps are meaningless and the representation is slightly misleading IMO.

Re: Most Pressed Keys and Programming Syntaxes

#43
post #14

"Shift" is a big omission, though you can guess at it from the emphasis on certain numeric keys. One of the great things about Python is that there are fewer chorded characters. It's also one of the worst things about Lisp on a standard keyboard.

Hi, I added shift counting to Mahdi's code a while ago: (https://github.com/zaki/Keyboard-Heatmap-1), so it should be easy to generate more correct heatmaps (in multiple keyboard layouts too) if you are interested.

Re: Most Pressed Keys and Programming Syntaxes

#44

It would be nice to see these heat maps normalized by the average frequency of each key. Then you can really see what stands out about each particular language.

... and normalized against the frequency of each letter in a dictionary of common English words. Most likely, 'e' is common in programming because it's the most common letter in English:

http://en.wikipedia.org/wiki/Letter_frequency

Re: Most Pressed Keys and Programming Syntaxes

#46
I skimmed comments here and couldn't find anything that talks about why e is so popular? Is it because ETAOIN? Because almost no "{" "}" pressed in C/Java. Almost no ":" used in Python. "/" key is more popular than "[" "]" in Objective-C. This makes no sense. I don't believe that blog post.

Re: Most Pressed Keys and Programming Syntaxes

#47
post #5

Earlier quoted context omitted.

It probably gets used about the same amount as the other languages, it's just that the parentheses get used an insane amount and outweigh all the other characters.

It might be more interesting to see these with the vowels factored out.

  ~ $ curl -s 'http://lib.store.yahoo.net/lib/paulgraham/onlisp.lisp' | egrep -o '.' | sort | uniq -c | sort -nr
  18641  
  3277 )
  3276 (
  2561 e
  2159 a
  1934 s
  1903 r
  1672 n
  1661 t
  1477 l
  1380 o
  1287 c
  1282 d
  1067 p
  1064 i
  1030 m
  [...]
Without vowels:

  18641  
  3277 )
  3276 (
  1934 s
  1903 r
  1672 n
  1661 t
  1477 l
  1287 c
  1282 d
  1067 p
  1030 m
   929 f
   852 b
   654 ,
   601 g
  [...]

Re: Most Pressed Keys and Programming Syntaxes

#48
post #29

Earlier quoted context omitted.

Still, the OP is right - for every character that can only be types by pressing SHIFT should also increase the counter for SHIFT.

If you want to be pedantic... "Shouldn't shift be twice as hot as the parentheses?" For offline analysis? No. Shift should be as hot as the SUM of both types of parentheses. In practice, both parentheses will be equal in count modulo some epsilon for unmatched parenthesis in strings and comments. Therefore, shift will be close to twice as either parenthesis. For online analysis? No. Shifted characters can come into e…

If you want to be pedantic...

Shift is used for many combinations besides just parentheses, such as that capital at the start of this sentence. It would likely be more than twice as much.

Re: Most Pressed Keys and Programming Syntaxes

#50
post #16
post #2

I admit, the Lisp one at the end made me laugh. For most other languages the focus seems to be mainly on letters (typing out keywords/identifiers), so in that sense there is little evidence that one language would be easier to write than another. Additionally, I imagine that some of the code is auto-completed by an IDE, which this analysis fails to account for.

Shouldn't shift be twice as hot as the parentheses?

Yes, and in fact they are ignoring Control, Space and Tab too.
Post reply on HN