Eagleson’s Law
Your own code, six months later, might as well be a stranger’s.
“Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else.” Nobody knows who Eagleson was. The line was already going around Usenet in the late 1980s, often with a reply attached: Eagleson is an optimist, the real number is more like three weeks.
The reply may be closer. In a 2018 study, Jacob Krüger and colleagues asked 60 open-source developers how well they still knew files they had worked on, and compared the answers with the version history. Their estimate: about half of what a developer knows about a file is gone after roughly 45 days, unless they keep coming back to it. Read the paper.
Reading is most of the job. A field study of 79 professional developers by Xin Xia and colleagues found them spending up to about 58% of their time understanding code, much of it in browsers and documents, looking for context the code didn’t carry. Read the study.
Clear names explain what the code does. Comments and commit messages can explain why: the $9 price is funded by a grant, and the number 2 means Tuesday. Write those details down while you remember them, so the next reader doesn’t have to guess.
Sometimes a deadline makes a quick solution reasonable. But code is often read and changed later. A little explanation now can save time then, even when the person reading it is you.