Eagleson’s Law After Caspar David Friedrich

Who wrote this?

Sam at the front desk needs two changes to the ticket prices. Click the highlighted code to change it. If you need clues, rub away the fog over its history or hold “Search history”.

You did. Six months ago, in a hurry, with everything you needed in your head.

Now write the original code, six months earlier. Choose between quick shortcuts and clearer explanations before the museum opens.

Six months later, someone opens price.js again. They only have what you wrote down.

October 20Digging: 0 min
OctApril 14. Doors open at 10:00

price.jsClick the code to change it

  1. function price(a, d, m, g) {
  2. if ( || || ) return 9;
  3. if (m && d == ) return 12;
  4. return 18;
  5. }
From Sam, front deskOct 20

Hi! The city grant ended on Friday, so we can’t charge the grant price any more. Kids still pay $9. The museum covers that now.

And member day is Thursday from now on. Can you update the till?

  • The grant pricesRemove the discounts that should end. Keep the children’s price.
  • Member dayChange the day number to Thursday.
From Rosa, front deskApr 14

New prices from today!

  • $9 Under 12, 65 and over, and school groups. The city grant pays the difference.
  • $12 Members, on Tuesdays. Tuesday is member day.
  • $18 Everyone else.

Doors open at 10. Thank you!!

October, againprice.js

Back into the fog.

Which $9 prices came from the grant?In the chat archive, 2 h 30 min
Which day is member day in the code?In the chat archive, 2 h 30 min

You wrote nothing extra down in April. The doors opened on time. In October, the next reader digs for about 2 h 30 min to find what you knew, or guesses.

History of price.jsRub away the fog to read the old messages.

a41c9e2Apr 14 · someone

fix prices

#front-desk · Apr 14, 9:47

Rosa New prices from today! $9 for under 12, 65 and over, and school groups. The city grant pays the rest. Members $12 on Tuesdays (member day). Everyone else $18.

someone On it before the doors open.

Changes: 0 struck, day unchanged.

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.

Rosa, Sam and the museum are invented. The dig times are illustrations, not measurements.

Caspar David Friedrich’s Wanderer above the Sea of Fog: a man in a dark green coat, seen from behind, stands on a rocky summit with a walking stick, looking out over a sea of fog broken by rocky peaks and distant mountains.
Caspar David Friedrich, Wanderer above the Sea of Fog, about 1817. We never see his face.Hamburger Kunsthalle