3 ms·
If the code is not intended to be thrown away after use, it should be written as simple and as cleanly as possible. You or somebody else will revisit the code
by jleyank 5y ago
If the code is not intended to be thrown away after use, it should be written as simple and as cleanly as possible. You or somebody else will revisit the code in 6+ months to fix a bug or make an enhancement. This requires reestablishing state and simplifying this process makes it safer and quicker.
There are a few times where code has to be cryptic and magical, but usually developer time is more valuable than cpu time. Good, stable code makes for happy users which makes for paid (or fame++) developers.
Kernighan: “Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?”
- AnimalMuppet 5y agoYeah, this. When you come back to look at the code 6 months later, you are effectively 10 years more junior than you were when you wrote it. Write accordingly.