Imagine you’re reviewing a piece of code. There’s something like…500 lines to look at. So you’re scrolling through the diff, checking things here, checking things there…
And in the background, the review software is recording which sections of the code you’re looking at.
I wonder if it’d be a useful metric to know what portions of the code were being looked at the most during a review? I believe it’s possible (at least within Firefox) to determine the scroll position of a window. I believe it’s also possible to determine the dimensions of the entire diff page, and the offset coordinates of elements on that page.
So shouldn’t it be possible to determine which elements were on the screen, and for how long?
Imagine seeing a “heat map” over the diff, showing where the reviewer spent most of their time looking.
Jason Cohen wrote that code reviews should take at least 5 minutes, and at most 60-90 minutes. I wonder if collecting this information would help determine whether or not a review was performed carefully enough.
Now, granted, there are plenty of ways to add noise to the data. If I’m doing a review, and stand up to go get a sandwich, and then my neighbour visits, etc…my computer sits there, gazing at those elements, and the data is more or less worthless…
Which brings me to:
Eye tracking is not a new technology. One of my roommates works at a lab where they do experiments with eye tracking tools. From what he tells me, the eye tracking gear in the lab is pretty expensive and heavy-weight.
But check this out:
So it looks like a webcam and some clever software can do the eye tracking trick too. This stuff is probably far less accurate than what my roommate uses – but it’s lighter, and cheaper, and therefore more likely to find its way into homes. So it looks like the day is coming where I’ll eventually be able to use my eyes to control my mouse cursor.
But, more interestingly, this more or less solves the problem with my Screen Age idea: this technology can tell when you’re looking at the screen. And it can give a pretty good guess about what area of the screen you’re looking at.
I wonder if collecting this information from code reviewers would be useful – what exact parts of the code have they looked at? And for how long? What have they missed? What did they gloss over?
UPDATE: Karen Reid has also brought to my attention the possibility of using this technology to see how TAs grade assignments by tracking what they’re looking at. Hm…