Live data from Hacker News

Most Pressed Keys and Programming Syntaxes

mahdiyusuf.com

51–60 of 75 posts

Re: Most Pressed Keys and Programming Syntaxes

#51
post #16

Earlier quoted context omitted.

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

No because this heat map is clearly generated "offline". That is, this is built from a source-file dataset. An "online" dataset would be the output of a key logger. Online analysis would show the number of right parentheses to be a tiny fraction of left parentheses due to auto insertion and other paredit-like operations.

Should the offline generate recognize ) as a combination of 0 and Shift anyway?

And furthermore, where are all the numbers, tabs and spaces?

Re: Most Pressed Keys and Programming Syntaxes

#52

Earlier quoted context omitted.

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.

A lot of emotions here. Making some of us jump to keyboard without reading carefully.

Re: Most Pressed Keys and Programming Syntaxes

#54
post #29

Earlier quoted context omitted.

No because this heat map is clearly generated "offline". That is, this is built from a source-file dataset. An "online" dataset would be the output of a key logger. Online analysis would show the number of right parentheses to be a tiny fraction of left parentheses due to auto insertion and other paredit-like operations.

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

Well, they could have used caps lock. Very unlikely I know.

Re: Most Pressed Keys and Programming Syntaxes

#55

I wonder what a programming language designed to minimize shifting would look like. Python does a pretty good job because it uses few curly brackets and no semicolons.

sadly, highly dependent on keyword layout, e.g. my keyboard has square brackets and the equals sign only accessible via a key combination, while the US keyboard does not. It seems the only safe character across many countries are 0-9a-z.,-\ plus space/tab/return. Not a lot to work with :)

That's part of why I always use a US layout, even on UK keyboards. Also because I've grown up with it.

Re: Most Pressed Keys and Programming Syntaxes

#56
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.

I'd love to see how Clojure compares, as it uses fewer parentheses and may even be competitive to, eg, Java in its use of parentheses.

As an aside, its interesting (to me, as a Colemak user) that all of the hot alphabetic characters in all the analyzed languages are on the home row of the Colemak layout (except L, which seems to be kind of hot in C++).

Re: Most Pressed Keys and Programming Syntaxes

#58
post #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.

Because it is the most common letter in English and used for variable and identifier names.

Re: Most Pressed Keys and Programming Syntaxes

#59
post #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.

I found the Objective-C one strange too. I would have thought '[' and ']' would have been two of the most pressed keys. I only really use '/' for commenting.

Re: Most Pressed Keys and Programming Syntaxes

#60
post #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.

Just off the top of my head, I'd guess it's due to a lot of e's in words that, depending on the language, you'll see in almost every single method or function. Things like return, end, else, true, include, self, private, etc.
Post reply on HN