To be great at anything, you run the extra mile, bench press the extra kg, and yes run the stairs before punching the air. So, as you crush your unrecyclable coffee cup, ignoring the fresh coffee stains on your sweatshirt and the environmental cost, you stare wildly across the Thames you know there’s nothing you wouldn’t do.

So, how to become a great programmer? Read other programmers code. “That’s easy” you rise on the caffeine surge and ready the next step. What should I read? This is where it gets tricky. With the notable exceptions of Knuth and Fitzpatrick most could recommend nothing.

No there isn't Donald. No there isn't.

Why am I writing this?

I am reviewing the available information and writing for a beginner reading open source. The best overview pieces are How to quickly and effectively read other people’s code and One sure fire way to improve your editing. This is a summary of all the content I’ve reviwed - the references section makes up all the content. The content is annecdotal - there’s nothing to say this is correct.

What to choose?

The general advice is to choose code that motivates you to understand it - the motivations are:

  1. Code you rely on
  2. Code that impresses you
  3. Code by people you like

If you’re new to code reading then choose something you understand to keep motivation.

Read code actively

The general advice is to have an ‘active reading style’ - take notes, explain problems, and treat it like a puzzle which can mean visual representations of the problem with charts, tables and diagrams - try to offload hard problems to ‘paper’.

  1. Work through the
    • Look at the examples
    • Keep and work through a list if there is over two items of interest
  2. Run the tests
  3. Choose a feature you are interested in
  4. Test you understanding by changing the code and running the tests
  • Accept that any code other than something you have just written is ‘crap code’

Watching this in action

Videos of this in action brought this together for me:

James Edward Grey II produced two videos on code reading called Codalyzed. He chose small libraries, Mote and Micromachine, and followed the ‘active reading style’. I recommend the videos … but you cannot buy them. There are unedited code readings on dotenv on youtube but the paid videos are better for being concise.

My Next Step

It’s surprising code reading isn’t a popular. Am I missing something? While disappointing, it will not stop me grabbing a library I can ‘grok’ and working through it in an active style.


I have found little on code-reading - are there more references?

1. Code is not literature

2. How to quickly and effectively read other people’s code

3. One sure fire way to improve your editing

4. LittleBIGRuby by James Edward Gray II

5. Good grief - while googling Knuth - I find xkcd were first - I will have to tell myself I’m a special comedy snowflake

6. 5 tips to quickly understand a new code base - FunFunFunction