<p>Whilst a comment like this could have been true when it was written, the code can change independently of the comment - making them out of sync and the comment no longer true.</p>
<p>As the comment is not evaluated or executed, there isn't a way to validate whether it's still correct, so whilst it could be, it may not be.</p>
<p>Comments should describe why the code is needed, not what it does.</p>
<p>If a comment describes the functionality, it can be refactored and extracted to a class, method or function - a.k.a. self-documenting code.</p>
<p>But, if you want something that will alert you if the functionality changes, look into <a href="/atdc">automated testing</a>.</p>
<p>If you have a passing test that suddenly starts to fail, you know the behaviour has changed.</p>
format:full_html
processed:|
<p>How often have you need code like this?</p>
<pre><code class="php">// Returns true.
return false;
</code></pre>
<p>Whilst a comment like this could have been true when it was written, the code can change independently of the comment - making them out of sync and the comment no longer true.</p>
<p>As the comment is not evaluated or executed, there isn't a way to validate whether it's still correct, so whilst it could be, it may not be.</p>
<p>Comments should describe why the code is needed, not what it does.</p>
<p>If a comment describes the functionality, it can be refactored and extracted to a class, method or function - a.k.a. self-documenting code.</p>