Interpreting Others' Source Code

Posted by Maxpm on Programmers See other posts from Programmers or by Maxpm
Published on 2011-03-07T13:24:25Z Indexed on 2011/03/07 16:18 UTC
Read the original article Hit count: 340

Filed under:
|
|

Note: I am aware of this question. This question is a bit more specific and in-depth, however, focusing on reading the actual code rather than debugging it or asking the author.

As a student in an introductory-level computer science class, my friends occasionally ask me to help them with their assignments. Programming is something I'm very proud of, so I'm always happy to oblige. However, I usually have difficulty interpreting their source code.

Sometimes this is due to a strange or inconsistent style, sometimes it's due to strange design requirements specified in the assignment, and sometimes it's just due to my stupidity. In any case, I end up looking like an idiot staring at the screen for several minutes saying "Uh..."

I usually check for the common errors first - missing semicolons or parentheses, using commas instead of extractor operators, etc.

The trouble comes when that fails. I often can't step through with a debugger because it's a syntax error, and I often can't ask the author because he/she him/herself doesn't understand the design decisions.

How do you typically read the source code of others? Do you read through the code from top-down, or do you follow each function as it's called? How do you know when to say "It's time to refactor?"

© Programmers or respective owner

Related posts about team

Related posts about analysis