Send More Paramedics


While listening to Starboy by The Weekend I’m reminded about some codebases that I have to dive into more deeply. When reading codebases, be they for fun or profit, I tend to take a systematic approach to exposing them, described as:

  • Get it building and running – not always as easy as it should/could be.
  • Change code to break it – Once it’s going I try to make changes to understand how and why they break things.
  • Understand all comments – Where applicable.
  • Delete all comments – To avoid biases.
  • Rename like mad – Going over the code I tend to rename functions and structures to fit my *current( understanding. This is an iterative approach as mu understanding deepens. In good codebases my final rename matches closely the original names.
  • Draw pictures – This is an ongoing and also iterative process.
  • Refactor code – Once I think I understand what it’s doing I try and refactor the code to my understanding. This hearkens back to breaking things. :p
  • (Re) Add comments – Comments are added back based on the understanding achieved (or not) and modifications made.
  • Read, read, read – Supplemental reading is an ongoing act.

Some great codebases I’ve read and mucked around with include:

C

Clojure

Pascal

JavaScript

Lua

  • Fennel – A Lisp compiler targeting the Lua runtime

C++

  • Factor – The VM for Factor is pretty amazing

Java

BASIC

  • 10 PRINT – A book about a tiny fragment of Commodore 64 BASIC

Rust

Emacs Lisp

  • Advice – Function advice implementation

There are countless other interesting codebases to explore and over time I’ll point out some more. These should keep us busy for a while.

:F