Live data from Hacker News

Most Pressed Keys and Programming Syntaxes

mahdiyusuf.com

81–90 of 99 posts

Re: Most Pressed Keys and Programming Syntaxes

#81

This just graphically displays what I whine about most of the time. Why does my pinky has to do most the work? My pinky is pretty short and all the pinky movements are awkward. It considerably slows down my code typing speed. I wonder If there would be another keyboard layout specially made for programmers. If you look at it you'll see that most of it has a similar pattern.

>> Why does my pinky has to do most the work?

Same thing happens with the saxophone keywork. It seems that pinkies get to handle all the stuff that was not included in the original spec.

Oh, you want to add a shift key? Let the pinky handle it. A C# key? No problem, we can fit it in the pinky cluster.

Re: Most Pressed Keys and Programming Syntaxes

#83
post #50

I photoshopped this really quick for to compare ruby on Dvorak and Qwerty. https://img.skitch.com/20110908-q24qths9k4u6438wpd989qreci.j...

Nice. This is the most interesting question about Dvorak, to me. Everyone I know who recommends Dvorak is a programmer. And I'm more than content with my comfort and speed typing English; the pain of slowing down to type brackets all the time when programming is more of a pain point for me. So with this in mind, it's interesting to note that Dvorak has moved the quote key to a slightly less favourable location, and b…

I personally use a variant of Programmer’s Dvorak. Brackets and various symbols are placed where you usually see numbers, while you have to press shift to access numbers. I think that on a proper Programmer’s Dvorak Caps Lock should cause shift to be in effect on the numbers/symbols buttons.

Re: Most Pressed Keys and Programming Syntaxes

#85
post #12

Lisp: http://dl.dropbox.com/u/2196687/lisp-keystrokes.png

My experience with Lisp is minimal, and I'm a Vim guy, so I may be totally wrong about this, but... Doen't nearly all serious Lisp developers use Emacs? And doesn't Emacs have piles of shortcuts for wrapping/unwrapping/manipulating s-expressions? I'd imagine that the resulting number of parens is wildly different than the number originally typed. Can any experienced Lispers comment on this? Where can I find a cheat s…

Not an experienced Lisper, but yes, you're right. If you made heatmaps of the original keystrokes, for a Lisper using Paredit, there would likely be a decent highlight on the open paren but almost nothing on the close, as Paredit inserts parens in pairs. Hitting ( inserts ().

I don't think Paredit isn't included in Emacs, but here's the relavent page on the Emacs Wiki: http://www.emacswiki.org/emacs/ParEdit and here's a cheatsheet: http://www.emacswiki.org/emacs/PareditCheatsheet

There's also something similar for Vim, or at least something bundled with slimv, which is more than just Paredit (supporting something like SLIME) http://www.vim.org/scripts/script.php?script_id=2531

Re: Most Pressed Keys and Programming Syntaxes

#86
post #12

Lisp: http://dl.dropbox.com/u/2196687/lisp-keystrokes.png

My experience with Lisp is minimal, and I'm a Vim guy, so I may be totally wrong about this, but... Doen't nearly all serious Lisp developers use Emacs? And doesn't Emacs have piles of shortcuts for wrapping/unwrapping/manipulating s-expressions? I'd imagine that the resulting number of parens is wildly different than the number originally typed. Can any experienced Lispers comment on this? Where can I find a cheat s…

Most Emacs lispers turn on Paredit after a little while. The major win there is never having invalid structure to your code, but there is the handy side-effect of never having to type a closing paren: http://www.emacswiki.org/emacs/PareditCheatsheet

Note the images in the article are done by static analysis of text files, which is very different from measuring what people actually type.

Re: Most Pressed Keys and Programming Syntaxes

#87

Earlier quoted context omitted.

Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…

What would be interesting here would be a difference analysis or regression giving the preference for any given key in a given language. E.g.: '|' is highly predictive of shell, '$' of perl, '()' for lisp. Might be fun to do in R.

I really need to do reading and research on this, but I'm pretty sure that's what Hidden Markov Models are for. You could watch a webpage go from HTML to javascript and back!

Re: Most Pressed Keys and Programming Syntaxes

#89
post #5

it'd be interesting to see these heatmaps in some sort of normalized way. for example, 'e' is the most common letter in english, so its the most commonly used letter in these programming languages. it'd be very interesting to see, for example, this heatmap with the intensities divided by each letter's frequency of use in the English language, or across a large set of data including a lot of different programming lang…

Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…

Could I ask for one more data: the total number of characters and maybe lines? That way symbol/alpha/line ratios could be compared to other languages.

Re: Most Pressed Keys and Programming Syntaxes

#90
post #5

it'd be interesting to see these heatmaps in some sort of normalized way. for example, 'e' is the most common letter in english, so its the most commonly used letter in these programming languages. it'd be very interesting to see, for example, this heatmap with the intensities divided by each letter's frequency of use in the English language, or across a large set of data including a lot of different programming lang…

Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…

Do you know why you have slightly different numbers of (){}[] characters? In C or C++ shouldn't those all be paired up to match?
Post reply on HN