▲ | rented_mule 3 days ago | |
Years later, when all memory of intent is long gone, I'd much rather work on a large code base that errs on the side of too much "throat clearing" than one that errs on the side too little. `sleep 1` tells what was written, which may or may not match intent. Many bugs come from writing something that does not match intent. For example, someone writes most of their code in another language where `sleep` takes milliseconds, they meant to check the docs when they wrote it in this language, but the alarm for the annual fire drill went off just as they were about to check. So it went in as `sleep 1000` in a branch of the code that only runs occasionally. Years later, did they really mean 16 minutes and 40 seconds, or did they mean 1 second? Leaving clues about intent helps detect such issues in review and helps debug the problems that slip through review. Comments are better than nothing, but they are easier to ignore than variable names. | ||
▲ | deadbabe 3 days ago | parent [-] | |
If the code isn’t working, then intent doesn’t matter. The code was wrong. If the code is working, the intent also doesn’t matter, what was written is what was intended. Do the requirements call for an alarm of 16 minutes 40 seconds? Then leave the code be. If not, just change it. |