Reading code

January 21, 2011

Then I really enjoyed reading code, because whenever I didn’t understand some pattern, I was like “Wait, why the fuck did they do it like this?” and I would look around more, and I’d be like “Wow, that is a really clever way to do this. I see how that pays off”. I would’ve done that earlier but I was afraid to do it because I was thinking that if it wasn’t my code, I wouldn’t understand it.
~ Brad Fitzpatrick

I wish I could also instill in more people the love that I have for reading original sources. Not just knowing that so-and-so gets credit for doing something, but looking back and seeing what that person said in his own words. I think it’s a tremendous way to improve your own skills.
~ Donald Knuth

One of the things I’ve been pushing is code reading. I think that is the most useful thing that a community of programmers can do for each other — spend time on a regular basis reading each other’s code.
~ Douglas Crockford

It’s very important to be able to get inside of somebody else’s way of thinking, to decode their vocabulary, their notation. If you can understand something about the way they thought and the way they made a discovery, then that helps you make your own discoveries. I often read source materials of what brilliant people have said about this stuff in the past. It’ll be expressed in unusual ways by today’s conventions, but it’s worth it to me to penetrate their notation and to try to get into their idea. For example I spent a good deal of time trying to look at Babylonian manuscripts of how they described algorithms 4000 years ago, and what did they think about? Did they have while loops and stuff like this? How would they describe it? And to me this was very worthwile for understanding about how the brain works, but also about how they discovered things. A couple of years ago I found an old Sanskrit document from the 13th century that was about combinatorial math. Almost nobody the author knew would have had the foggiest idea what he was talking about. But I found a translation of this document and it was speaking to me. I had done similar kinds of thinking when I was beginning in computer programming.
~ Donald Knuth

Over the years I’ve kind of made a generic mistake and the generic mistake is to not open the black box. To mentally think, this black box is so impenetrable and so difficult that I won’t open it. […] As you get to the boundary you think “I don’t want to go through the boundary”, because what’s underneath is — you imagine — enormously complicated. But again, it turns out to be very easy.
~ Joe Armstrong

The job of a mathematician is to make proofs but almost never, when you’re solving a mathematical problem, do you find a theorem for which the hypotheses are exactly what you need for the problem you’re solving. Almost always you’ve got something that’s sort of like the theorem that’s in the book. So what you do is you look at the proof of that theorem and you say “Oh, ghere’s how I have to change that proof in order to prove the hypothesis that I really have”. So mathematical books are packed with theorems, but you never plug in exactly the theorem — you want to see that proof because it’s one time in a hundred when you’ll find just the theorem that you wanted. I think it’s exactly the same with software.
~ Donald Knuth

%d bloggers like this: