Hacker News new | ask | show | jobs
by flyinglizard 1388 days ago
All the more reason not to make it any more complicated than necessary (even if it's in the expense of some code elegance). Not just for other people, but also for the future you, coming to maintain this. Going back to your code after three years, and someone else approaching the code for the first time are not that much different.

Also this is why I love automation, like scripts for everything. It's like a memo to your future self, with the side benefit of sparing you menial work. I keep even single one liner commands as their own shell scripts with a descriptive name.

Try to read and understand everything your write. If it doesn't click immediately or needs too much outside context or "working memory", make it simpler. Failing that, elaborate in comments.

1 comments

Sometimes it has to be complicated. Complication in one area (usually infrastructure code) enables simplicity in other areas (usually application code). An OS memory manager deals with the complexity of page management, so as to present the nice abstraction of an orderly address space to applications. An SQL query optimiser is complex in order to allow dumb and "understandable" queries from applications.