Comment Use the tools Borge (Score 0) 254
Reading other people's code is a punishment that one must master if you hope to grow as a programmer. My favorite approach these days is to use callgrind and kcachegrind, walking up and down the call stack for each stimulus I can muster. I often build a custom client to send malformed requests for these tests, it usually becomes part of my unit/regression tests. Then I make note of the most prominent function names and data structures. I construct an outline as if I were writing a book. GDB is also a fantastic tool for understanding software. You can learn a lot about code merely by setting a break point in malloc or read. Don't be afraid to use 'set var' to explore an interesting test case. strace, particularly with -c or -ff, can give you a quick idea of what a program does. Eventually I start to change it. First I use indent or some IDE to fix the whitespace, then I start to refactor. Eventually the code begins to look more like something I wrote than what I inherited. That's how I know when it's time to hand it off to someone else ;)