9 ms·
Most Pressed Keys and Programming Syntaxes
- dodo53 15y agovim and emacs would be fun too :oP
- deleted 15y ago[deleted]
- doki_pen 15y agoI'd love to see a keyboard layout based on data like this.
- egiva 15y agoIt already exists in terms of a more logical layout for faster typing of many latin-based languages. Instead of QUERTY keyboard, it's called the Dvorak layout and is really common in certain circles and places - I believe that in OS X you can switch to this alternative layout pretty easily if you're interested in learning a faster way of typing. More info here: http://atmac.org/dvorak-keyboard-layout-switching http://atmac.org/dvorak-keyboard-layout-switching
- ZeroGravitas 15y agoThere's also some programmer versions of Dvorak, that make the punctuation more accessible too (by demoting numerals to needing the shift-key to be held): http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard#Programmer_Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard#Prog... Just as Dvorak was based on letter usage, this is based on examining large bodies of code just like the heatmaps in the OP.
- tomjen3 15y agoIt is a bit more than just switching the keys and numbers around - it uses the information from the code it examined to intelligently put the special chars that are used most often were they are easiest to access. And yes if you wonder, it is awesome to use.
- andylei 15y agoit'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 languages
- wccrawford 15y agoFor this reason, I think it would have been more interesting to ignore the alphabet keys and just heatmap the rest.
- delinka 15y agoBut then you lose the impact of the entire set of reserved words. At the point of ignoring the entire alphabet, you're looking at developer preferences for spacing and operators. Might be a nice sidebar to the existing heat maps.
- pyre 15y ago> you're looking at developer preferences for spacing > and operators Not really. For example, in languages that use $ (e.g. Perl, PHP) to denote a variable, that's not developer preference. I'm actually surprised that there aren't more operators being used in Ruby. Though I'm not a Ruby programmer, it does not look as devoid of punctuation characters as the heatmap suggests.
- cpeterso 15y agoWhat would a programming language look like if it was optimized so its reserved keywords used mostly home row letters (and, in Unix tradition, preferably alternated left/right hands) and operators without shifting? This would be tough, since the home row only has one vowel: a.
- aangjie 15y ago
- zyb09 15y agoClearly ObjC programmers are the only ones, who comment their code responsibly.
- fullmoon 15y ago(or have to ;) )
- mmariani 15y agoIf you code responsibly in ObjC there's no need to write comments. Therefore, if someone "has to" comment ObjC code there's something wrong with their practices. The same holds for almost any language, but in ObjC that's just natural.
- jcizzle 15y agoI imagine this comes from the fact that: 1. ObjC is only used on Apple's platforms (and the less popular GNUStep). 2. You'll have to use Xcode to write for these platforms (less popular alternatives don't add up here). 3. Xcode automatically inserts 7 lines of comments with // at the top of every file. Two files per class, 28 /'s per class.
- saintfiends 15y agoThis 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.
- tomjen3 15y agoIt is funny that you should mention it, because I have spent a lot of time finding keyboard layouts more suitable for programing. In the end I settled on the programmer dvorak layout. It is basically a standard dvorak keyboard but with the special keys you need to program moved to easier locations (and the dvorak keyboard itself uses the homerow much more efficiently, so there is much less strain on your fingers and your wrists).
- saintfiends 15y agoI have thought about switching to Dvorak, it's hard to find from where I live. I'd love to know what model or brand you settled for.
- ZeroGravitas 15y agoIf you mean buying a hardware keyboard with dvorak letters, then don't. If you learn to touch type (and there's no point switching to Dvorak if you don't intend to) then you don't need to look at your keyboard, indeed being able to will only teach you bad habits. Print a paper copy of the key layout to pin next to your monitor when starting out and use a typing tutor like gtypist to train yourself instead.
- saintfiends 15y agoI have no problem typing without looking. Problem as I mentioned above, it is difficult to type with my pinky. It is kind of short (Not oddly short, just that I have shorter fingers than average) and it's awkward. That's what slows me down. So I'm looking for a layout which makes my other fingers work more.
- quellhorst 15y agoWould like to see a Dvorak version of this.
- tomh- 15y agoLisp: http://dl.dropbox.com/u/2196687/lisp-keystrokes.png http://dl.dropbox.com/u/2196687/lisp-keystrokes.png
- michaelcampbell 15y agoThe "-" key isn't even lukewarm which seems odd to me given what little I know about lisp.
- KirinDave 15y agoI thought that to, until I saw the note saying Paul Graham wrote it. Arc is noticeably terse, and avoids the use of - key wherever possible.
- michaelcampbell 15y agoAh! That explains it; thanks!
- snprbob86 15y agoMy 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 sheet of such shortcuts?
- spacemanaki 15y agoNot 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 http://www.emacswiki.org/emacs/ParEdit and here's a cheatsheet: http://www.emacswiki.org/emacs/PareditCheatsheet 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 http://www.vim.org/scripts/script.php?script_id=2531
- robert_nsu 15y agoI looked at the heatmaps, then looked at my keyboard. The keys with rubbed out labels nearly match his findings 100%. My 'N' isn't (only because the key is slightly larger than my other keys). Other than that, he is spot on.
- jevinskie 15y agoI'm curious, why do you have a large N key?
- camtarn 15y agoErgonomic style split keyboard, I'm guessing? http://www.compkeyboard.com/uploadpic/Microsoft%20Natural%20Keyboard%204000-2.jpg http://www.compkeyboard.com/uploadpic/Microsoft%20Natural%20...
- robert_nsu 15y agoYeah, that's the one. I use this for my office keyboard and a Logitech G510 at home.
- jholman 15y agoInteresting thought about the labels. Mine mostly do not match. In fact, on my keyboard, N is the most-obliterated key label, followed by MAD<. Also damaged: GHSECV. I think I can blame ASD on games, and E should be obvious. So why are CVNM< so very heavily worn? My best guess is that the labels are on the upper section of the keys, which is presumably the laziest part of the key for my fingers to reach?
- 5hoom 15y agoInteresting to note the difference between C and C++ with regards to the '*' and '&' keys. I know there is a lot of raw pointer and address usage in C, but I'm surprised at how little these keys show up in C++. It's good to see that people are taking advantage of smart pointers ;) (It's subtle though, so I could be reading too much into it).
- frou_dh 15y agoSeems odd that < and > are said to be used more in C than in C++ (templates).
- deleted 15y ago[deleted]
- pagekalisedown 15y agoIt's common to typedef the templated types you use. ex: typedef std::tr1::smart_ptr< MyClass > MyClassPtr;
- MicahWedemeyer 15y agoThe most pressed keys are ⌘ (or CTRL), C, and V.
- Newky 15y agoThe javascript image shows limited to no usage on the $ key, Doesn't say a lot for jQuery usage.
- s00pcan 15y agoIn the codebase here we use 'jQuery' instead of '$'.
- falcolas 15y agoDitto. If you pull in multiple plugins or additional frameworks (for some reason, we mix YUI with jquery), the $() notation can become broken, and you have to explicitly call jQuery().
- udp 15y agoUnless you put all your code in a big closure to make a correct $ in function scope: (function ($) { }) (jQuery);
- iks 15y agoThe article mentions that "the heat map does miss out on things like shift and caps. ex. in perl with the dollar sign. ($)".
- jrockway 15y agoYeah, but the $ is shown as frequently-pressed in the Perl heatmap, so that must not be what he means.
- deleted 15y ago[deleted]
- quellhorst 15y agoI photoshopped this really quick for to compare ruby on Dvorak and Qwerty. https://img.skitch.com/20110908-q24qths9k4u6438wpd989qreci.jpg https://img.skitch.com/20110908-q24qths9k4u6438wpd989qreci.j...
- jholman 15y agoNice. 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 basically banished paren/bracket. Not a solution for my pain point!
- IvarTJ 15y agoI 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.
- waffle_ss 15y agoDon'tcha know Colemak is the latest craze?
- landhar 15y agoThe problem with this is that you can't tell the difference between numerals and symbols or even worse between two symbols in the same key (such as '_' and '-').
- Kwpolska 15y agoDoesn't PHP use a colon at the end of every line? WTF?
- shabble 15y agoNo. It uses a semicolon to delimit statements within blocks, but (afaik) placing each statement inside its own <?php ... ?> tag would be valid. There's also the alternative syntax[1], which is mostly used for templating these days, which looks like <?php if ($foo): ?> ... html ... <?php endif; ?> and is probably the only place other than a ternary operator that might conceivably end a line with a colon. [1] http://php.net/manual/en/control-structures.alternative-syntax.php http://php.net/manual/en/control-structures.alternative-synt...
- Kwpolska 15y agobut the <?php ?> don't seem to be used too much on this heatmap.
- Androsynth 15y agoAs php code gets more structured, its moving towards MVC frameworks where php tags are used sparingly in the views. (they are a fast way to make spaghetti code)
- KirinDave 15y ago4 of my haskell files put into heatmap. One of them is an applicative-functor-style use of attoparsec, which tends to have more punctuation than normal haskell code. Even with the frequent use of :'s, $'s and ()'s, the alphanumeric keystrokes dominate the input. http://fayr.am/9xkE http://fayr.am/9xkE You can compare this to the Lorum Ipsum text map and see its only slightly different: http://fayr.am/9yk6 http://fayr.am/9yk6 I dunno what that means or what sort of value judgements it drives, but it's pretty different from the other heatmaps.
- jerf 15y agoAnd on Dvorak, all of the yellow letters except the "R" are on the home row.... (R is on the O.)
- 4ad 15y agobased on my visual observation, apart from lisp, python seems to skew furthest away from average. Its heatmap is much cooler, with less extremes. I wonder why.
- deleted 15y ago[deleted]
- saintfiends 15y agoIn reality though enclosing glyphs will not be very well balanced. Opening brackets will be typed more than closing brackets.
- duck 15y agoWhitespace hasn’t been taken into consideration (tabs and spaces) which would have been a cool thing to see. I think if that was included this would be a lot more useful. Is there a reason it wasn't?
- jemfinch 15y agoThis really needs to take into account modifier keys (in particular, shift).
- bfung 15y agoOf course there's also the missing shortcut keys. For example, Java projects using an IDE would probably have crtl-space be the most frequently pressed keys (autocomplete).
- MrVitaliy 15y agoThe title is misleading. They just extracted character frequencies from source files which fail to capture 'Delete', 'Shift', 'Ctrl', 'Alt', etc keys. Even has Paul Graham name at the end, as if 'Look, this is totally legit!'
- bostonpete 15y agoWell, Ctrl and Alt aren't related to the programming language (more the editor or OS) and neither is Delete. Shift is, but that could have (should have IMO) been extracted from the character frequencies in the source files...
- swannodette 15y agoIt's interesting to note that a big reason ( ) dominate in Lisp here is that pg adopts the FP habit of short var names. If anything this is probably just a measure of the tendency to use long vs short name - mainstream OO practice encourages the former. It would be interesting to rerun the heatmap for Lisp with a typical CLOS program. I think you'll find that ( ) no longer dominate. EDIT: And in fact here's a heatmap of core.logic (1K LOC) which is fairly OO-ish in its design - http://twitpic.com/6hwj88 http://twitpic.com/6hwj88. ( ) are strong but do not dominate everything. UPDATE: And here's a 1.4K LOC Clojure program, core.match http://twitpic.com/6hwo8w/full http://twitpic.com/6hwo8w/full. ( ) again do not dominate.
- bryze 15y agoHas anyone done this for programmer Dvorak yet? I guess I'm just looking for validation..
- swannodette 15y agoJust to drive the point home, Clojure's core.clj is 6,500+ lines of Lisp, funny enough, parens do not dominate - http://twitpic.com/6hwt28/full http://twitpic.com/6hwt28/full.
- daniel_solano 15y agoWell, there is a very good reason for this: Clojure tries to reduce the number of parentheses by substituting other characters, namely square brackets []. For example: ; Common Lisp (defun add (x y) (+ x y)) ; Scheme (define (add x y) (+ x y)) ; Clojure (defn add [x y] (+ x y)) Also, Clojure eliminates some parentheses that are used in other Lisps: ; Common Lisp and Scheme (cond ((> x 0) 1) ((= x 0) 0) (t -1)) ; Clojure (cond (> x 0) 1 (= x 0) 0 :else -1)
- ori_b 15y agoInteresting. It seems strange that Javascript and Ruby seem to use 'r' significantly less than other languages. I have no idea why that would be.
- cwp 15y agoHere's one for Smalltalk. It's based on my .changes file - about 200K LOC, with all the lines containing '----' and $! removed. What's left is, I think, stuff that actually got typed into a browser. You can definitely see $:, but otherwise it looks pretty much like English.
- hernan7 15y agoPerl programmers do seem to comment a lot... the "#" looks almost as heavily used as the "$", which is mandatory for variables.
- killion 15y agoI bet the backspace key is used the most.
- francescolaffi 15y agotime for a programmer keyboard layout? "ASERTNIOL" in the middle line would be good for several langs
- danobeavis 15y agoapropos of the brainfuck reference earlier today, here is a brainfuck interpreter, written in brainfuck, visualized through the keyboard heatmap. http://i.imgur.com/lSDYJ.jpg http://i.imgur.com/lSDYJ.jpg
- yvdriess 15y agoIt appears that it just scans source files, not actual key presses. I barely touch the parenthesis keys when programming Lisp for example.
- pa7 15y agoIf anyone cares: I just added the DVORAK keyboard layout to the keyboard heatmap and open sourced the code. Here is the repo URL: https://github.com/pa7/Keyboard-Heatmap https://github.com/pa7/Keyboard-Heatmap