3 ms·
I believe you have missed the author's point - "Using more code is actually the lazy fix." The author would recommend something like: $this->executeAfter(5
by jamescostian 10y ago
I believe you have missed the author's point - "Using more code is actually the lazy fix." The author would recommend something like:
$this->executeAfter(5); // Execute after 5 seconds
The above code is only 1 line, and is very clear. It does not add a brand new, unnecessary class, nor does it increase the surface area for bugs (adding a new class opens up the potential for new bugs, while adding a comment does not).
- andreygrehov 10y agoThis is not entirely true. It depends on the language, but the definition of executeAfter for the most of dynamic languages would be something like public function executeAfter($seconds) This code does not guarantee that the value of $seconds is correct, whereas this: public function executeAfter(Time $time) ...will help engineer to not make silly mistakes. It definitely depends on the language, but I personally like self-explanatory code and tend to think that inlined comments should only describe things that require explanation, such as complex logic.