Settings

Theme

Ask HN: What are your tips for reading other people's code?

2 points by autogol 9 years ago · 2 comments


Eridrus 9 years ago

Depends on how long you have, how unfamiliar the code/build is and what the goal is, but spend as much time as reasonable getting tools to work first.

Make sure you can figure out what function is actually getting called when you see a function name. Tools like Source Insight can be useful if you need to get up and running quickly since they support very loose searching rules. I've also heard good things about SciTools Understand, but never used it myself.

The best thing though would be to get the software running in a way that you can debug it. Being able to step through code and see how data is modified and which particular implementation of an interface gets called, etc, can be very helpful.

Being able to exercise the code in question always makes it easier to understand because you can think about it in larger blocks than trying to form an picture of the larger goal line by line.

NigelR 9 years ago

Read through some of the code with the original author. It may seem obvious and it's not always possible, but when you can do this you can cut hours off the time it takes to understand the code and other code that the author wrote.

What you'll get from this that would be more challenging on your own:

- design tradeoffs

- high level design

- the author's coding patterns

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection