rewriting all the code
I tend to rewrite code. A lot. The terminal-based text editor I’ve been building, aretext, started as a Rust project, but after a month I rewrote it in Go. At one point, the editor embedded a Python REPL, which I later ripped out and replaced with a searchable menu. I completely rewrote the input interpreter, syntax highlighting parser, word movement calculations, and fuzzy find algorithm – multiple times!
Last night, it occurred to me that I might have rewritten all the code in aretext at least once by now. So I searched for “git ship of theseus” and discovered this blog post about visualizing code churn. I ended up using a tool called hercules to analyze the aretext repository. Here’s the chart it generated:
The chart shows how many lines of code were added each month, and how many of those lines remained in the codebase in subsequent months. Contrary to my expectations, some code in aretext dates back to earliest months of the project! Color me surprised.