Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Modeling How Programmers Read Code

Soulskill posted about a year ago | from the read,-comprehend,-complain-about-the-dunce-who-wrote-it dept.

Programming 115

An anonymous reader writes "Following up on an experiment from December, Michael Hansen has recorded video of programmers of varying skill levels as the read and evaluate short programs written in Python. An eye tracker checks 300 times per second to show what they look at as they mentally digest the script. You can see some interesting differences between experts and beginners: 'First, Eric's eye movements are precise and directed from the beginning. He quickly finds the first print statement and jumps back to comprehend the between function. The novice, on the other hand, spends time skimming the whole program first before tackling the first print. This is in line with expectations, of course, but it's cool to see it come out in the data. Another thing that stands out is the pronounced effect of learning in both videos. As Eric pointed out, it appears that he "compiled" the between function in his head, since his second encounter with it doesn't require a lengthy stop back at the definition. The novice received an inline version of the same program, where the functions were not present. Nevertheless, we can see a sharp transition in reading style around 1:30 when the pattern has been recognized.'"

Sorry! There are no comments related to the filter you selected.

Slashdot is dead (0)

Anonymous Coward | about a year ago | (#44207029)

As "the" read and evaluate?

Re:Slashdot is dead (2)

grub (11606) | about a year ago | (#44207073)

All we need is confirmation from Netcraft.

Re:Slashdot is dead (-1)

Anonymous Coward | about a year ago | (#44207191)

niggers dont read code so this study is RACIST

Re:Slashdot is dead (0)

Anonymous Coward | about a year ago | (#44209395)

Obligatory [pigroll.com]

Re:Slashdot is dead (1)

Anonymous Coward | about a year ago | (#44207133)

That just confirms that Soulskill is an expert editor who processes the meaning of an entire paragraph at a time, instead of scanning each word like a beginner would.

Re:Slashdot is dead (0)

Anonymous Coward | about a year ago | (#44209583)

Soulskill is a little bitch. He'd get his ass handed to him by Justin Bieber.

wow (1)

crutchy (1949900) | about a year ago | (#44207075)

if i smoked enough pot i bet i could make my eyes move like that too

Interesting. (-1)

Anonymous Coward | about a year ago | (#44207085)

I've been programming for a long time, and I still tend to scan over the code, looking at defs. Or if I'm in a proper IDE, looking at the class outline first. Then I go to the entry point, if there is one, or the init if there isn't, and read through that line by line.

Re:Interesting. (2)

davester666 (731373) | about a year ago | (#44207611)

Obviously, you haven't progressed past the 'beginner' stage...

Re:Interesting. (0)

K. S. Kyosuke (729550) | about a year ago | (#44207887)

One data point in a multidimensional space does not a dataset make.

Re:Interesting. (1)

maxwell demon (590494) | about a year ago | (#44208969)

One data point in a multidimensional space does not a dataset make.

Of course it does. It doesn't make a very useful dataset, and certainly not a statistically significant one, but it is a dataset nonetheless.

This must be a taxpayer-funded experiment (-1)

Anonymous Coward | about a year ago | (#44207091)

Newsflash: when confronted with a situation falling within their specialized field, experts can process information in large chunks. Whereas laymen and novices tend to process things one small piece at a time; and on top of that, they flail around a lot.

Thanks guys! A bargain that some of my tax money is going for your next NSF grant.

Re:This must be a taxpayer-funded experiment (3, Insightful)

K. S. Kyosuke (729550) | about a year ago | (#44207961)

when confronted with a situation falling within their specialized field, experts can process information in large chunks. Whereas laymen and novices tend to process things one small piece at a time; and on top of that, they flail around a lot.

Actually, that's a load of nonsense:

1) With programs that are *actually* large, you won't find "experts" that consume them in "large" chunks, unless they use very small fonts.

2) With programs that are new to the readers, you might have to read in toto them anyway. There's no guarantee that the *actual* dependencies in the code will allow you to read it in a limited or strictly hierarchical fashion. You gotta read what you gotta read. It's not like people will only shove neat and pleasurable code on you in real life. If the code is messy, your reading of it will most likely be messy, too. Especially if you hit duplications and have "wait a minute, didn't I see this somewhere else? Lemme check" moments.

Re:This must be a taxpayer-funded experiment (1)

StewBaby2005 (883886) | about a year ago | (#44209271)

Personally, I would scan the whole code , if it was short, to asses the style of whomever wrote it, plus alterations.. It's art, not science

Re:This must be a taxpayer-funded experiment (0)

Anonymous Coward | about a year ago | (#44210505)

Ultimately this study only is there to prove that programmers don't really "see" code like this http://duelofseashells.files.wordpress.com/2011/12/matrix11.jpeg

Every non-techie person I know seems to think techies see the world this way. Honestly the reality is all techies we see the world like this. http://2.bp.blogspot.com/-I1amyM5uSt4/TlG9sr4SX8I/AAAAAAAAADk/vMmsvYgqIrc/s1600/matrix-code-neo.jpg

Different code == invalid results (5, Informative)

phizi0n (1237812) | about a year ago | (#44207093)

This article is complete garbage. They tested 2 people with different code that produces the same results and then make up a narrative of how novice and expert coders think in different ways. Use the same code to test a much larger pool of programers and then the results might actually be interesting.

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44207195)

This article is complete garbage. They tested 2 people with different code that produces the same results and then make up a narrative of how novice and expert coders think in different ways. Use the same code to test a much larger pool of programers and then the results might actually be interesting.

You fool! If they did it _your_ way they wouldn't get to tell us what a great expert their buddy Eric is. Duh!

Re:Different code == invalid results (-1)

Anonymous Coward | about a year ago | (#44207203)

They read python.

The novice was probably looking for anything that looked like an actual English word and instead found only a mass of special characters.

Python is not a language, it's cryptology.
 

Re:Different code == invalid results (1)

jythie (914043) | about a year ago | (#44207235)

You mean unlike every other programming language with its special characters?

Re:Different code == invalid results (1)

maxwell demon (590494) | about a year ago | (#44208997)

You mean unlike every other programming language with its special characters?

How many special characters does COBOL have?

Re:Different code == invalid results (3, Funny)

Nerdfest (867930) | about a year ago | (#44207239)

You may have Python confused with Perl.

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44207243)

For cryptological applications I'd rather use perl programs.
Distinguishing perl code from a stream of random data is one of the undecidable problems of computation.

Re:Different code == invalid results (1)

AuMatar (183847) | about a year ago | (#44207593)

For actual cryptology I wouldn't use anything on a VM. There's very sophisticated attacks on cryptology implementations that measure things like battery power differences and time to calculate that can even tell if there's an extra if statement in there and use that to find a higher probability of a bit being a 1 or 0. If I was writing a real encryption library I wouldn't want anything that could add unseen time dependencies, like garbage collecting things at different times. Its pretty much C or asm.

Re:Different code == invalid results (1)

Anonymous Coward | about a year ago | (#44207903)

For actual cryptology I wouldn't use anything on a VM. There's very sophisticated attacks on cryptology implementations that measure things like battery power differences and time to calculate that can even tell if there's an extra if statement in there and use that to find a higher probability of a bit being a 1 or 0. If I was writing a real encryption library I wouldn't want anything that could add unseen time dependencies, like garbage collecting things at different times. Its pretty much C or asm.

don't you have it completely backwards? wouldn't you rather use a system that has unpredictability in it, like garbage collecting(depending on free mem on the machine it might not kick in at the same time) than something that is easier to predict.

besides you're talking about a local attack when everything is lost anyhow so fuck it...

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44207927)

Did you hear that?
Of course you didn't.
  Let me draw a diagram to explain it so you can understand.
--------> (Joke)
.
<- Oort cloud.
.
<- stratosphere.
.
<- roof.
.
.
o
-|- - You
^

Your assessment of potential risks in using toy^H^H^Hinterpeted languages with huge libraries with undefined side effects is not off by much but I don't think I can trust your "real encryption library" if you read code as well as you read plain text.

Re: Different code == invalid results (3, Informative)

Anonymous Coward | about a year ago | (#44208261)

Your stick man needs to see a chiropractor STAT!

Re:Different code == invalid results (1)

brickmack (2537604) | about a year ago | (#44210127)

That's a rather odd scale.

Re:Different code == invalid results (1)

chris.alex.thomas (1718644) | about a year ago | (#44208613)

the point of programming an cryptological algorithm is that the code executes an encryption algorithm, not that the source code IS the encryption algorithm...... ;)

Re:Different code == invalid results (2)

maxwell demon (590494) | about a year ago | (#44209011)

Distinguishing perl code from a stream of random data is one of the undecidable problems of computation.

Interestingly the Perl interpreter seems to solve it quite well. Maybe I should try if it can also solve the halting problem? ;-)

Re:Different code == invalid results (1, Troll)

Burdell (228580) | about a year ago | (#44207257)

The novice was probably looking for anything that looked like an actual English word and instead found only a mass of special characters.

Python is not a language, it's cryptology.

What are you, a COBOL programmer? That's nice, we'll get off your lawn now.

Re: Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44210257)

When Python has gone the way of Pascal, COBOL will still be creating your paycheck.

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44207855)

Huh? I admit I haven't programmed all that much in python, but in my experience python is pretty far on the keyword side of the keywords-vs-operators axis.

Re:Different code == invalid results (2)

tricorn (199664) | about a year ago | (#44207463)

It might help if you actually read the articles linked to. It's an ongoing study, and results are "very preliminary".

It looks like they have various code samples. The same functionality is coded in different styles. They're studying both how novice vs. experts read code, as well as how coding styles/language features affect comprehension.

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44207841)

> It might help if you actually read the articles linked to. It's an ongoing study, and results are "very preliminary".

Doesnt matter. Slapping "very preliminary" on it does not excuse garbage results.

Re:Different code == invalid results (1)

Wildclaw (15718) | about a year ago | (#44208545)

It looks like they have various code samples. The same functionality is coded in different styles.

More like it is coded in good and bad styles. The video at the top is the worst, full of bad style. Just to go through it all:

* Bad naming of parameters. Both collections and iteration variables feel like the same.
* No methods and data of program wide priority (x, y) declared at different locations.
* Using "between" instead of "in interval. There are only really one reason to use exclusive intervals, and that is when the algorithm naturally ends up on it (for example when looping over zero-bound arrays). Otherwise, humans have a far easier time thinking inclusively than exclusively,
* Mixing superiority in comparisons.

In a clear style, "(2 < x_n) and (x_n < 10)" would be expressed as "(i >= 3) and (i <= 9)" with the looping variable properly renamed from x_n to i.

Re:Different code == invalid results (1)

Rockoon (1252108) | about a year ago | (#44208589)

with the looping variable properly renamed from x_n to i.

'x_n' is not an index, proving that you still havent comprehended the code....

The variable 'x_n' is a member of the list, not an index into the list. While 'x_n' might be a bad name, 'i' is a horrible name.

Re:Different code == invalid results (0)

Anonymous Coward | about a year ago | (#44208607)

A programmer would often use x or n for the variable in question.

x is already taken so n is probably best, but then n would be used twice on two different lists so its x_n and y_n to distinguish which lists. Poor superfluous use of underscores unless in python this is somehow normal to do.

Re:Different code == invalid results (1)

mwvdlee (775178) | about a year ago | (#44207487)

Yeah, somehow I think their expert Eric compiling a function in his head is somehow affected by the fact that he actually HAD functions in his version of the code to compile. If you were to run any type of code metrics on those fragments, the inline version would be rated as much more complex.

Re:Different code == invalid results (0)

Forever Wondering (2506940) | about a year ago | (#44208275)

Yes, complete [and utter] ...

I've been programming for 40+ years and how I analyze code [and hence, my "eye track"] varies, depending upon what I'm looking for. If I need to know one thing, I'll tend to zero in quickly. If I'm going to make changes, I'll scan over everything [at least] once to try to glean the overall style so I'll know what I'm up against when/before I start to make the changes.

Not only that, but the article's last line is about "joining the experiment" if you're in the Bloomington, IN area [*].

Indiana? Indiana??? A fine state for many things [America's home for auto racing--the sport of kings :-)] ...

But, how about choosing a place noted for its programming talent (e.g. Silicon Valley, Boston/128, Los Angeles, San Diego, Research Triangle Park, NC, NYC, etc.)?

[*] Also, is there some special camera setup required that only the author has? Couldn't this be done by downloading the eye track software and programming examples onto any computer [anywhere] that has a builtin webcam? With a questionnaire about one's programming background? That way, data on thousands of people could be correlated.

Re:Different code == invalid results (1)

BlackPignouf (1017012) | about a year ago | (#44208359)

Also, I suppose the code was written either by a Python novice or a FORTRAN expert :D
I'm more of a Ruby guy, but I learned Python a few months ago, and one nice thing about it are list comprehensions (the syntax will probably get messed up by /.):

x_n = [2,8,7,9,-5,0,2]
y_n = [1,-3,10,0,8,9,1]

def between(numbers,low,high):
    return [x for x in numbers if x>low and xhigh]

def common(list1,list2):
    return [x for x in list1 if x in list2]

x_btwn = between(x_n,2,10)
y_btwn = between(y_n,-2,9)

print x_btwn
print y_btwn
print common(x_btwn,y_btwn)

here is a nickel, buy a real language (-1)

Anonymous Coward | about a year ago | (#44207115)

Only a braindamaged lemming would be reading python

real languages are also free, but not fashionable (0)

Anonymous Coward | about a year ago | (#44207497)

Brain-damaged lemmings are exactly the sort of hipsters that are into python. Back in my day there were great languages like Delphi that would draw the fashion-conscious coders and keep them far away from the rest of us.

Re:here is a nickel, buy a real language (0)

Anonymous Coward | about a year ago | (#44207617)

Oh no! *Explodes*

Re:here is a nickel, buy a real language (1)

brickmack (2537604) | about a year ago | (#44210171)

Why? It's a reasonably good language for most high level stuff

Video Speed? (4, Interesting)

Psychotria (953670) | about a year ago | (#44207127)

Is that video real time (adjusted for the 300Hz sample rate)? I ask because I'm not a Python programmer (I do know C, C++, asm) but about 10 seconds into the video I knew what the program would print and yet the video went on for 3 minutes. Something does not add up.

Re:Video Speed? (1)

Psychotria (953670) | about a year ago | (#44207167)

I just watched Eric's video. Which is different code (wtf?). Even then I wouldn't read it like he does. They definitely need to refine their experiment's methodology a little bit (ok, a lot) and get a bigger sample group.

Re:Video Speed? (1)

Anonymous Coward | about a year ago | (#44207249)

This might be it:
Expert programmer + Phython programmer = NaN

Re:Video Speed? (3, Insightful)

Psychotria (953670) | about a year ago | (#44207733)

Although I don't necessarily agree with your Python joke (pretty funny, though) your comment does provoke me to wonder if Eric really is an "expert" programmer. His eyes go all over the place even when they don't have to. There's only 2 conditions to remember and one "function" (set intersection). His eyes skip all over the place. Further, after the two sets are formed (he's written them in the box and he's already determined what common() does) why is he even looking at the function common() again? Maybe it's to double check, but surely remembering two conditions and a set intersection (3 operations) is well within the grasp of human short-term memory and surely you'd only look at the function name (what it does was verified earlier). Personally after I'd glanced at between() and common() to confirm they did what they suggest they do, I'd never look at them again. But his "expert" eyes keep going back to them while he is forming his output.

Re:Video Speed? (1)

Psychotria (953670) | about a year ago | (#44207739)

Adding to my own comment. There's only one condition to remember; I was getting confused with the inline version of the novice. Why he keeps looking back over their code/implementation is bizarre to me... it kind of defies the point of functions in the first place. I'm not an expert but I reckon he's not an expert either.

Re:Video Speed? (1)

K. S. Kyosuke (729550) | about a year ago | (#44207935)

His eyes go all over the place even when they don't have to. There's only 2 conditions to remember and one "function" (set intersection). His eyes skip all over the place.

My eyes often go all over the place because I'm restless a lot of the time. It doesn't necessarily need to correspond to my mental processes, which is completely lost on the eye tracker. I really don't think that it's possible to make far-reaching conclusions from strictly local stuff like this. The skills in comprehending large programs seem much more important to me (just as it's precisely those large programs that need those skills in the first place), and an eye tracker alone won't help you with researching into the associated habits.

Re:Video Speed? (1)

Shalcker (989572) | about a year ago | (#44208063)

Maybe what actually gets committed to short-term memory is "there is definition of performed function _here_ (eye position)" - transforming it into memorized conditions and intersection would take longer then to simply reparse it, so brain takes easy way out. Programmer can remember function, but doesn't if he doesn't have to.

Re:Video Speed? (1)

Psychotria (953670) | about a year ago | (#44208895)

Yeah I agree, but watch Eric's (the expert) video again. He doesn't just glance at the function definition; he steps through it.

Re:Video Speed? (1)

Psychotria (953670) | about a year ago | (#44208929)

In C, for example, do you step through printf() every time you call it? Of course not... you probably don't even have the source code. The only thing that matters is input, output, pre-conditions and post-conditions. But, yeah, maybe expert Python programmers think differently.

Re:Video Speed? (1)

Livius (318358) | about a year ago | (#44208287)

Perhaps the novice is expecting the code to follow a straightforward algorithm, and the expert just assumes Python will be full of counter-intuitive operations and hidden side-effects buried in spaghetti code.

Re:Video Speed? (1)

Psychotria (953670) | about a year ago | (#44208933)

Hard to tell when we're only comparing two people :-)

Re:Video Speed? (1)

guruevi (827432) | about a year ago | (#44210457)

I work with eye trackers on an almost weekly basis. These videos are severely slowed down for us to see the interaction. And yes, us humans have the tendency to read an entire page over and over again (subconsciously) even if entirely unnecessary. The saccades may have been scanning for more information or indeed to confirm something (our memory is incredibly short and prone to error, programmers definitely would know that they can't trust what they remember about a function or input data) or simply thinking (what you may call "staring").

Re:Video Speed? (0)

Anonymous Coward | about a year ago | (#44211637)

This is what I'm wondering. Was pretty much instantly apparent what would be output and I wasn't familiar with the syntax of this particular language.

By novice.. do they perhaps mean someone who is not a programmer to begin with? In which case, I'm somewhat impressed they were able to solve it.

read code? (1)

Anonymous Coward | about a year ago | (#44207209)

I don't even read it, I close my eyes, which are a hindrance, and use my inner eye to feel the code. I become the code. Most times I look like a bowl of spaghetti

Re:read code? (2)

Livius (318358) | about a year ago | (#44208291)

"With the blast shield down, I can't even see!"

"Your eyes can deceive you - don't trust them."

Bad link (5, Informative)

Anonymous Coward | about a year ago | (#44207225)

They should link to the follow up post that talks about the experiment with 162 programmers http://synesthesiam.com/posts/what-makes-code-hard-to-understand.html. It also links to the paper that has even more information.

Invalid results? (3, Insightful)

flimflammer (956759) | about a year ago | (#44207245)

The code between these two individuals is completely different, even if it produces the same results. How do you discern any meaningful results out of two people reading two different sets of code?

Re:Invalid results? (0)

Anonymous Coward | about a year ago | (#44207761)

This, the entire point of experiments is to have a variable be compared against a constant, and this experiment lacks a constant.

other factors have alot to do with this?? (1)

Anonymous Coward | about a year ago | (#44207253)

the style of the code might also make a difference (as well as the specific languages use of form)

Code of more than average complexity also shifts the reading patterns, as would non trival agorthms that require more study to figure out what it actually does

I have my own code style that assists in fast scanning and placements of specific language features for when Im working on a project of 100000 lines of actual code (30 years a programmer and I also dont care for having 100s/1000s of tiny files spreading out content )

the display itself (and tools IDE which might not efficiently display code) - there is an effect of how much text is visible without scrolling also will have an effect

don't give PHB's any ideas we don't need metrics (2)

Joe_Dragon (2206452) | about a year ago | (#44207275)

Some call centers / help desks suck with BS metrics and scripts.

We need less BS metrics as people just game them and people who do a good job have poor metric scores and some with lines and lines of bloated code gets a good score.

Re:don't give PHB's any ideas we don't need metric (4, Insightful)

PolygamousRanchKid (1290638) | about a year ago | (#44207545)

Unfortunately, this thing seems to be en vogue in the computer fashion industry. I just attended a conference where this phrase could some up a bunch of the presentations:

"We are modeling, tapping into the power of social networks, and doing visual analytics!"

I happen to be reading The Psychology of Computer Programming, Silver Anniversary Edition" right now. An interesting quote:

The only thing that's changed here in twenty-five years is the fact that the funds dedicated by executive to eliminating programmers from their payrolls have become far more staggering than I imagined back then. And, now, I finally recognize in this executive desire a pattern so strong, so emotional, that it has blinded these executives to two facts:

1. None of these schemes has succeeded in eliminating programmers . (We have now at least ten times as many as we did then.)

2. Every one of these schemes has been concocted by programmers themselves, the very people the executives want so passionately to eliminate.

So, although people say that programmers lack interpersonal skills, they evidently have a skill at persuasion that surpasses that of the late, great P:T: Barum, famous for his theory: "There's a sucker born every minute."

I guess if I need some money for something from executive, I'll tell them that I need it to model, tap into the power of social networks and do visual analytics. That ought to get me my funds.

Re:don't give PHB's any ideas we don't need metric (0)

Anonymous Coward | about a year ago | (#44207757)

The executives in my company seemed genuinely surprised that a programme to let call centre staff _make customers happy_ rather than sticking to scripts and hitting their metrics, actually resulted in better satisfaction and retention metrics.

Customers are only calling us because something went wrong, so the chance that a mechanical "just follow the script" solution is appropriate is very small, and thus it ought to have been no surprise at all that the new programme was an improvement, but still they had to be cajoled into it by expensive consultants.

OT: Dwightmare at Yahoo (-1)

Anonymous Coward | about a year ago | (#44207291)

Just scanning the front page crawl over at Yahoo [yahoo.com] , I marvelled at the number of headlines involving the NBA's Dwight Howard (a free agent center who just left the LA Lakers to join the Houston Rockets). Here's my count:

  • Dwight Howard Free Agency: 5 Winners and Losers of the Dwightmare
  • Dwight Howard contract includes early opt-out and trade kicker, according to report
  • Dwight Howard: Kobe never offered to teach me how to be a champion
  • Dwight Howard asked Lakers to hire Phil Jackson
  • With Dwight Howard gone, Lakers will no longer consider using the amnesty provision on Pau Gasol
  • Shaq says Dwight Howard couldn’t handle the pressure of playing for the Lakers (VIDEO)
  • Lakers fans burn Dwight Howard jerseys, we come up with better solutions
  • Howard turns Rockets from promising to contenders
  • Lakers may move Gasol back to center "Losing Dwight Howard to the Houston Rockets allows the Los Angeles Lakers..."
  • Dwight Howard can become free agent in 2016
  • Lakers re-group after being spurned by Howard
  • Dwight Howard tweets that he'll sign with Rockets
  • NBA free agency rumors: Pau Gasol staying with Lakers, LeBron James going to L.A., and more "It's over! Dwightmare is officially over!"
  • Dwight Howard discusses Houston Rockets decision, says he wanted Phil Jackson as coach in LA
  • NBA Roundup: Howard deal worth $88 million, Gasol moves to center for Lakers

Sounds like Ms. Mayer gave a special order to her editor...

300 Hz (1)

flyingfsck (986395) | about a year ago | (#44207345)

It seems line Hansen is still a novice too - sampling 30fps video at 300 Hz...

Re:300 Hz (1)

tricorn (199664) | about a year ago | (#44207453)

What makes you think he's sampling 30fps video? There's even a link to the eye-tracking hardware.

http://www.tobii.com/en/eye-tracking-research/global/products/hardware/tobii-tx300-eye-tracker/ [tobii.com]

Re:300 Hz (1)

flyingfsck (986395) | about a year ago | (#44207921)

A human being's reaction time is in the order of 100ms, so sampling at 300 Hz is ridiculous whichever way he does it.

Re:300 Hz (0)

Anonymous Coward | about a year ago | (#44207955)

What's reaction time got to do with this?

Re:300 Hz (4, Informative)

ThreeKelvin (2024342) | about a year ago | (#44208157)

Human eyes "flicker" when they look at something. They will remain stationary for a time, then move quickly to another position. (See Saccade [wikipedia.org] .)

The time for one of the fast movements between positions is in the order of 20 ms when reading, giving us a frequency of about 25 Hz. (It's only half a sine wave, so the period is 40 ms.)

Using the Nyquist-Shannon sampling theorem [wikipedia.org] , we get that we must sample the eye movement with a frequency of at least 50 Hz, otherwise we'll get aliasing. Now, bring in the engineering rules of thumb, which say that it's no good riding on the Nyquist limit, but you'll need to oversample the signal a bit in order to get a useable result (It of course all depends on what you'll be using the signal for. In feedback control you usually oversample by a factor of 8-20, and in signal processing in the neighbourhood of 2-8) and you end up with a samping frequency of 100 - 400 Hz.

So, in summary, 300 Hz sounds like a perfectly good sampling frequency, perhaps even a bit in the low end, depending on what you'll use the sampled signal for.

Re:300 Hz (2)

Antique Geekmeister (740220) | about a year ago | (#44208999)

And _that_ is why so many A/D systems fail miserably: because people have been very, very confused by sampling theory.

Just because it takes 100 msec to respond does not mean that the eye motion takes anywhere that time, and the motion is not "clocked" or linked to some discrete frequency. It's analog, and to measure its impulse driven movements properly you need to oversample temendously, or use some sort of triggered sensor that can record its triggers very accurately.

Re:300 Hz (1)

Zero__Kelvin (151819) | about a year ago | (#44209837)

"A human being's reaction time is in the order of 100ms, so sampling at 300 Hz is ridiculous whichever way he does it"

It seems perfectly reasonable to me, so I have to ask: What frequency do you recommend?

Dupe? (3, Interesting)

dohzer (867770) | about a year ago | (#44207349)

A real programmer would have done differently (0)

Anonymous Coward | about a year ago | (#44207419)

Just run the code. There, you have the output. Problem solved. Now, seriously. It took me less than a minute to figure out what it would do. So maybe I'm an expert programmer? Most of my time was spent making sure their code wasn't doing something sneaky like changing a variable later on, or printing a variable with a slightly different name.

Re:A real programmer would have done differently (1)

AuMatar (183847) | about a year ago | (#44207601)

And are you sure the code isn't malicious? Not a good idea.

Ignoring that possibility, I very rarely need to know what a program does- I need to know how it does it in order to fix it or add features. You don't get that from running it.

Re:A real programmer would have done differently (1)

Psychotria (953670) | about a year ago | (#44207743)

I need to know how it does it in order to fix it or add features. You don't get that from running it.

Surely once you verify a function does what it is supposed to do you don't keep going back and stepping through it again, though? (referring to Eric the expert's eye movements here). What's the point in that?

Re:A real programmer would have done differently (1)

AuMatar (183847) | about a year ago | (#44207813)

Not unless I think I missed something, or its a tightly coupled implementation with another function. My point was just that "just running" code isn't a good idea and doesn't generally get you what you need.

Re:A real programmer would have done differently (0)

Anonymous Coward | about a year ago | (#44208031)

I very rarely need to know what a program does

Is there another meaning to 'what a program does', or did you just imply you fix/add functionality to programs without knowing what problems they're trying to solve?

Re:A real programmer would have done differently (1)

loufoque (1400831) | about a year ago | (#44208189)

You can tell it's not malicious from a glance. To be malicious it would need to access the filesystem, networking or interprocess subsystems.

Re:A real programmer would have done differently (1)

maxwell demon (590494) | about a year ago | (#44209067)

It could output a text which, when read, causes harm to you. Like the funniest joke of the world.

Re:A real programmer would have done differently (1)

loufoque (1400831) | about a year ago | (#44209127)

Then it would be a good death.

Re:A real programmer would have done differently (1)

thorntonmark (1223742) | about a year ago | (#44209089)

Why just not read the comment that tells you what it does?

An interesting case study (0)

Anonymous Coward | about a year ago | (#44207653)

Cognitive scientists have been studying saccades for a long, long time. Interesting to see it used to measure screen-reading changes in an expert vs. a novice.

Some "expert"... (0)

Anonymous Coward | about a year ago | (#44207717)

Did anyone notice that the "expert" got the answer wrong in his video? See here. [youtube.com]

The second line should be "1 0 8 1" and the third line should be "8 9 0". The "novice" got these answers correct.

Re: Some "expert"... (0)

Anonymous Coward | about a year ago | (#44208333)

The novice getting it right just further proves he's a novice. Any experienced programmer knows that getting the job done fast (and getting the product out the door) is more important than getting it right (has Dilbert thought you nothing?).

Give the newbie time and he'll be under pressure & time constraints ... and he'll rush his work too.

Re: Some "expert"... (1)

chris.alex.thomas (1718644) | about a year ago | (#44208629)

> (has Dilbert thought you nothing?).

I suppose he doesn't think about many people except himself, thats why he doesnt teach anymore :)

Just evaluate it (1)

loufoque (1400831) | about a year ago | (#44207983)

If you want to know what a code prints, just evaluate it, it will tell you instantly without having to worry whether you made a mistake in evaluating the code in your head.
Now if you want to understand the code, that's something else, but it's not what's asked here. The code is sufficiently straightforward that the only explanation you could give is the code itself.

They both made a mistake! (0)

Anonymous Coward | about a year ago | (#44208347)

It's amazing what kind of inaccurate stuff get's posted on here.
Clearly from both videos - the tested programs to read were not even the same. The novice one dosen't have functions and does everything inline, whereas the 'expert' one uses functions.
Also - both 'programmers' made mistakes when predicting their outputs. The novice used brackets which aren't part of the output stream and the expert's last two lines read 1 0 9 1 , 9 instead of 1 0 8 1 , 8 9 . It's nice to see the amount of people on slashdot who can't even comprehend a 20 line program yet still bother to comment on it. Grep!

Re:They both made a mistake! (1)

maxwell demon (590494) | about a year ago | (#44208875)

How would a 9 end up in the last line if the second line has no 9 in it?
As far as I can see, the third line should only have an 8, nothing else.

Re:They both made a mistake! (1)

maxwell demon (590494) | about a year ago | (#44208957)

OH, BTW, I just tried to print an array with Python, and it *did* output brackets and commas. So the novice was right and the expert wrong in that regard.

raspberry jam or rc-drone counter-measure (0)

Anonymous Coward | about a year ago | (#44208781)

SELF-DEFENSE: Apply a generous portion of rasberry jam on the camera.
OFFENSE: Have a radio-controlled drone 24/7 tracking the researcher's eyes, hands and every other part of his body and stream it on the web.

Workplaces are pushing "Nobody has a right to privacy" and "We are going to measure you whether you like it or not".

Reports like these make the slower coders feel like they are worthless. Eventually this will backfire and "the observed" will retaliate by reclaiming their digital freedoms and privacy. They will also retaliate by making those researchers feel worthless also. We wouldn't mention other methods to do so because we don't want those researchers to see it coming.

Point of focus (1)

maxwell demon (590494) | about a year ago | (#44208849)

When reading the lines

In this last 30 seconds or so of the novice video above, you can see her back-and-forth comparison of the x and y lists. If you look carefully, however, the red dot (her gaze point) is often undershooting the numbers on both lists. Why is this? While it could be a miscalibration of the eye-tracker, the participant may also have been using her parafoveal (the region outside the fovea) to read the numbers. This and the fact that foveation and visual attention are not necessarily always the same (i.e., looking at something doesn't always mean you're thinking about it) encourages us to be cautious when interpreting eye-tracking data.

I suddenly realized that while reading those lines I indeed was focusing below those lines. I have no idea if this was an unconscious reaction on reading this, or if I do that always (unfortunately my very awareness of this will affect any result, so I can't test this for myself).

This gives "reading between the lines" a whole new meaning ;-)

Or to put it another way (0)

Anonymous Coward | about a year ago | (#44209169)

x = [2, 8, 7, 9, -5, 0, 2]
print [xn for xn in x if 2 < xn < 10]

y = [1, -3, 10, 0, 8, 9, 1]
print [yn for yn in y if -2 < yn < 9]

print [xn for xn in x if xn in y]

Re:Or to put it another way (1)

Clueless Moron (548336) | about a year ago | (#44211453)

x = [2, 8, 7, 9, -5, 0, 2] print [xn for xn in x if 2 < xn < 10]

y = [1, -3, 10, 0, 8, 9, 1] print [yn for yn in y if -2 < yn < 9]

print [xn for xn in x if xn in y]

Funny thing is, I find that easier to read and understand than the original. It's like "make a list of the elements in this range and print it", twice over, and finally "make a list of the stuff in x that's also in y and print it".

Flash? (1)

hobarrera (2008506) | about a year ago | (#44209593)

It's funny how there's huge amounts of people criticizing flash on slashdot every day, and then we have an article with a flash video (I can only assume it's a video, since I don't run flash) attached to it.

Do these guys even know how their target audience is?

What the fuck is this shit (0)

Anonymous Coward | about a year ago | (#44210137)

I can't believe this shit is published on a popular news website. Seriously. First, what the fuck do we learn by studying how different programmers look at different codes? My guess: absolutely nothing. Next, the "expert" programmer made two huge mistakes and didn't even realize it. Is this shit for real? When the "expert" had to find numbers between (but not including) -2 and 9, he somehow missed 8, using 9 instead. Then, when he had to find numbers that were common to both lists, he missed 66% of them because he used the wrong goddamn lists. I won't even mention the fact that you don't even need to look at the code to figure out what the functions do - they are written in plain english. I could figure out this code in 10 seconds with 100% accuracy. It took their "expert" 1 minute to do a really bad fucking job. So now we are comparing two different programmers looking at two different codes - one does it correctly, the other does shit. And of course, it makes Slashdot because you dickheads are so blinded by "hey, it's programming!" to actually curate good content. Fuck this shit, I'm going back to the NYT Science Blog, bitches.

Huh? (0)

Anonymous Coward | about a year ago | (#44211349)

Do all expert programmers read all code the same way? If I had a mass of uncommented C code to digest, I'd read it much differently than well-written Python or Java with complete JavaDoc comments. Wouldn't the quality of code affect how the code is read by an expert? I don't read math books the same way I read history books, either.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?