Until AI is compiling straight to machine language, code needs to be readable.
Until AI is compiling straight to machine language, code needs to be readable.
Comments lie. Names lie. Code is the only source of truth.
If you believe your reductive argument, your function and variable names would all be minimally descriptive, right?
“sleep 1” is the complete expression. Because sleep takes a parameter measured in seconds, it’s already understood.
You do not need “delay_in_seconds = 1” and then a separate “sleep delay_in_seconds”. That accomplishes nothing, you might as well add a comment like “//seconds” if you want some kind of clarity.
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.
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.
delay = Duration.milliseconds(1)