Hacker News new | past | comments | ask | show | jobs | submit login

> A year later I looked at the code and couldn't figure out how it ever worked in the first place . . .

Isn't that the norm ?




Probably. It actually had the opposite effect on me. I try to keep my code cleaner and more understandable now. I'll stick in better, more expansive comments in difficult spots.

I'll schedule a code review with peers. If I can explain/justify an ugly hack maybe it's not so bad. But sometimes the fundamental "wrongness" of some piece of code just drives me to try and find a better fix. One of those classic trade-offs, elegance vs expediency.


Similar experience here. When I look at code I wrote 20 years ago I always get the impression I was a better programmer then than I am today simply because it takes me a lot of time to understand what I was trying to achieve.

My 'new' code looks so simple and direct in comparision. No more trickery with setjmp and longjmp and no more abuse of side effects.

Then I realize that the simplicity is actually better, not the hacks of old.

What is surprising though is that it seems almost as if every generation of programmers has to learn these lessons all over again.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: