3 ms·
Along the same lines, I see this a lot long delay = (5 * 60 * 1000); // 5 minutes, in millseconds And it's perfectly clear to me. Now, I think the comment
by RHSeeger 3y ago
Along the same lines, I see this a lot
long delay = (5 * 60 * 1000); // 5 minutes, in millseconds
And it's perfectly clear to me. Now, I think the comment is really helpful there (indicating intent), but I don't think having separate constants for each of the numbers there is going to make the code better. As it is, it's very easy to read at a glance, know what it's intended to do, and determine if it's correct (should you be worried about that at the moment). Which is what's important there.
- gregmac 3y agoI do that as well, but typically name that variable delayMilliseconds so there's no confusion. sleep(delay) always looks ok, but sleep(delayHours) is probably going to catch your eye as suspicious.