JIT Reading

February 24, 2018

Seibel, James Hague and others have all tried to justify why code reading is so uncommon, and they make good points. But perhaps the conversation is led astray by use of the word read. I wonder if Abelson and the others would have had more examples if Seibel had asked them what code they had learned about for fun. Perhaps the word “read” put them in a passive frame of mind, caused them to filter out programs they’d hacked on?

We all read code already; it’s just that we usually read when we want to edit. And the comprehension that questions about reading really focus on comes from both reading and writing, interleaved in complex ways. (Outside of programming, Cal Newport has called this the “make your own textbook” method.)

That hacking produces better comprehension than passive, linear reading fits with what we know about learning. Barbara Oakley, Herbert Simon, Cal Newport, and Anders Ericsson all describe how solid understanding emerges from active exploration, critical examination, repetition, and synthesis. Hacking beats passive reading on three out of four of these criteria:

Learning through hacking also leverages the natural structure of a codebase. Good books guide their readers through series of questions and their answers, whereas codebases distribute answers to external questions throughout their structure. In its non-linearity, a codebase resembles a map. You can ask an infinite number of questions of a map. How far is it from A to B? Which is the nearest town to C? But you can’t expect a map to tell you what questions to ask, and it makes no sense to read a map linearly from top to bottom, left to right. Yet we still tell people to read codebases linearly even though we would never tell them to do this for maps.

Future solutions and recommendations for code comprehension should focus on providing good questions and changes to guide exploration, making it easier for readers to answer their own questions about codebases, and encourage active engagement over passive reading. While I’m much less sure of how to do this than I am that it’s a good idea, here are a few preliminary thoughts:


It turns out others have explored similar ideas that I explore here from different angles:

Discussion, links, and tweets

I'm a software developer currently working at UberEats. I keep a low social media presence, but, if you enjoy what I have to say or want to rant at me, you should email me at stephenmalina@gmail.com. If you're interested in what I'm currently programming, check out my Github. I occasionally rant on Twitter as well.