Have you ever written code no one could understand?

2 points by neilk ↗ HN
Followup from the other thread about inheriting incomprehensible codebases. It's easy to be self-righteous about the poor programming practices of those who came before us, but maybe a little confession would be good too.

3 comments

[ 3.1 ms ] story [ 22.8 ms ] thread
I had to encode a factory's shift schedule. I noticed that it repeated in a regular way with each month. Then I noticed that there was yet another, more subtle symmetry in between weeks, so I encoded that too. Then I realized the remaining pattern was a simple wavy line, so I replaced that part with a function based on a sine wave with the appropriate amplitude and period.

In my defense, I was 16.

Abstractions strike again!
I’ve written code that I can’t understand:

"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." - Eagleson's law