Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming

How Experienced And Novice Programmers See Code 238

Esther Schindler writes "We always talk about how programmers improve their skill by reading others' code. But the newbies aren't going to be as good at even doing that, when they start. There's some cool research underway, using eye tracking to compare how an experienced programmer looks at code compared to a novice. Seems to be early days, but worth a nod and a smile." Reader Necroman points out that if the above link is unreachable, try this one. The videos are also available on YouTube: Expert, Novice.
This discussion has been archived. No new comments can be posted.

How Experienced And Novice Programmers See Code

Comments Filter:
  • Re:Code? (Score:5, Insightful)

    by Rockoon ( 1252108 ) on Wednesday December 19, 2012 @02:58PM (#42338609)
    I see lack of comments, lack of comments, and god damned polish notation.
  • by loufoque ( 1400831 ) on Wednesday December 19, 2012 @03:03PM (#42338661)

    Novice programmers are simply overwhelmed by vast amounts of code, and have no idea how to do large-scale software development.
    When you teach them about tools that allow you to find your way through the code, they're all impressed.

    Universities simply aren't teaching these boys right.

  • Re:Comments (Score:5, Insightful)

    by Anonymous Coward on Wednesday December 19, 2012 @03:07PM (#42338703)

    Comments that describe what the code is doing are useless. Comments that describe why the code does what it does are invaluable.

  • Re:Comments (Score:5, Insightful)

    by Trepidity ( 597 ) <[gro.hsikcah] [ta] [todhsals-muiriled]> on Wednesday December 19, 2012 @03:09PM (#42338721)

    If I'm reviewing untrusted third-party code, or code which is suspected to be buggy, I agree, but it really slows things down, even at an expert level, to completely ignore comments, if it's a setting where I'm working with people I know to be good engineers, and am not actively debugging/auditing their code. There has to be some amount of trust to make large projects work, and trusting that my colleagues are writing sane and reasonably accurate comments is one form of it. If it turns out to be wrong in a certain case, well, that's what tests are there to discover.

  • Re:Comments (Score:5, Insightful)

    by Anrego ( 830717 ) * on Wednesday December 19, 2012 @03:16PM (#42338809)

    Those inline comments are good (when done properly) when trying to quickly grok through a large codebase. That "done properly" bit is important. Obviously a comment that just states what the following line does is pointless.. but a one liner generalizing a 9 or 10 line block of code means 9 or 10 lines of code you can skim over.

    Obviously if troubleshooting code or auditing you want to focus on the code, but then the comments still serve as a good tool to indicate potential problems by as you said, showing what the authors intention was. If the code doesn't match the comment.. the code might very wlel be wrong.

  • Re:Code? (Score:5, Insightful)

    by Anonymous Coward on Wednesday December 19, 2012 @03:19PM (#42338855)
    An inexperienced coder sees code they have written, and everything else is unintelligible crap that only a moron would have written.

    An experienced coder just sees everything as unintelligible crap that only a moron would write.
  • Re:Comments (Score:5, Insightful)

    by dgatwood ( 11270 ) on Wednesday December 19, 2012 @03:20PM (#42338859) Homepage Journal

    Comments that describe what the code is doing are useless. Comments that describe why the code does what it does are invaluable.

    Depends on the level of granularity. Comments that describe what a single line of code does (or even a small number of lines of code in many cases) are useless.

    Comments that describe the behavior of a suitably large block of code (e.g. a function or a block within a particularly complicated function) can help you quickly understand the structure of a program as a whole. This is critical when working with sufficiently large bodies of code, because you're unlikely to have time to read every line of code before you start hacking away at it. For sufficiently complex projects, they can also be pulled out by tools such as HeaderDoc or Doxygen and converted into documentation.

    At a semi-coarse granularity, comments that tell you what a block of code within a function does can make it much easier to find the code you need to change when something doesn't work. Thus, even those comments can be useful, so long as each comment covers at least a handful of lines of code and so long as the "what" isn't instantly obvious at a glance.

  • by obarthelemy ( 160321 ) on Wednesday December 19, 2012 @03:23PM (#42338885)

    Young programmers see code as a way to show how good they are

    Old programmers see code as something that puts money in the bank.

    What off topic ?

  • by Ignacio ( 1465 ) on Wednesday December 19, 2012 @03:25PM (#42338919)

    Unfortunately if you give them the most advanced tools possible then they never actually *leave* the novice state since they're too used to their tools doing all the work for them.

  • Re:Code? (Score:4, Insightful)

    by boristdog ( 133725 ) on Wednesday December 19, 2012 @04:01PM (#42339497)

    Polish: Making wood shine at the beginning of a sentence.

  • Re:Skipping (Score:3, Insightful)

    by andy16666 ( 1592393 ) on Wednesday December 19, 2012 @04:08PM (#42339607)
    I wouldn't trust anyone to know what they look at when they read code. Not because I think they're lying, but because other research shows that people often have no idea how they perform complex tasks. So I'd be very skeptical if even your most candid account of how you code or how you read code showed much correlation to how what you actually do when you perform these tasks.

    This is one of the things that makes teaching so difficult. If it were just a matter of explaining what you do, it would be simple, but for many tasks you don't actually know. You have to learn all over again when it comes time to teach it.
  • Re:Code? (Score:3, Insightful)

    by Anonymous Coward on Wednesday December 19, 2012 @04:11PM (#42339665)

    I feel immense shame, horror and bewilderment when I look at my old code. Did I really write this rubbish?

"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde

Working...