Recently I was talking with a coworker, Yoav, and he stressed the importance of reading code as a way to grow as a programmer. He then reminded me of all the great programmers in Coder’s at Work who talked about the importance of reading code.
Turns out reading code is a pretty common trait of extremely successful programmers. I pulled out a few quotes talking about the importance of reading code. I hope these quotes will be as encouraging to you as they were to me! I think we should all try to put a bigger effort into reading more code:
I think an hour of Code reading is worth two weeks of QA… If you have someone who is really strong reading, then the novices around them are going to learn a lot they were going to learn otherwise, and if you have a novice reading code, he’s going to get a lot of really good advice
Always try to do something a little harder, that’s outside your reach. Read code. I heard this a lot, but it didn’t really sink in until later. Then I got on the Internet and there’s all this open source code I could contribute to but I was just scared shitless that if it wasn’t my code and the whole design wasn’t in my head, then I couldn’t dive in and understand it.
Then I was sending in patches to Gaim, the GTK instant-messenger thing, and I was digging around that code and I just saw the whole design. Just seeing parts of it, I understood. I realized after looking at other people’s code, that it wasn’t that I memorized all my own code; I was starting to see patterns. I would see their code and was like, “Oh, OK.” I understood the structure they were going with.
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 it 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, creator of LiveJournal, memcached
You were asking earlier what should one do to become a better programmer? Spend 20 percent of your time learning stuff – because it’s compounded. Read Hammond’s paper [“You and your research”]. It’s good. Very good.
Joe Armstrong, creator of Erlang
One example was one of my employees who had built a parser. This was later on for the PTRAN project. And I wanted to understand his methods. It’s actually probably the best parser in the world – now it’s out in open source, and it’s really an extraordinary parser that can do error correction in flight.
I wanted to understand it, so I took it and read it. And I knew that Philippe Charles, the man who had written it, was a beautiful programmer. The way I would approach understanding a new language or a new implementation of some very complex problem would be to take a program from somebody that I knew was a great programmer, and read it.
Fran Allen, Turing Award winner for work on compiler optimization
These quotes help remind me that we’re not coding in a vacuum. I think it’s interesting that we don’t read code more as software engineers. Great writers are oftentimes the greatest readers as well, pulling techniques from their favorite authors and eschewing those that they don’t like. Historians don’t start from scratch when doing research. Why should programmers have to re-invent coding techniques when there is a whole body of experience that came before us?
Yoav challenged me to spend 30 minutes a day reading code. I think it is a great challenge, and I challenge you to do the same. I know I’m excited to see what I’ll learn!