On Tue, Dec 4, 2012 at 6:30 AM, Henrik Sperre Johansen < [email protected]> wrote:
> On 04.12.2012 12:49, Stéphane Ducasse wrote: > >> Comments are ***REEEAALLLLY*** important because they help a guy reading >> the code to say yes you are smart and you got it right >> I will explain you why. >> >> Even writing comment in test is cool. >> >> Stef >> > I would go so far as to say comments in tests are *especially* important. > It's sometimes hard to tell whether a failure is due to a faulty test, or > an actual bug, when you have no idea (even when looking at the code) what > case the test was actually written to cover. > With a comment of what the test was intended to do, you have a better feel > for how to handle it. > True, to a point. As long as later coders that alter the method/class/package either adhear to the original comments, or update the comments when they change the behaviour/intent of the code, or at the very least, delete the comment when they make significant changes that would invalidate the comment, this is true. If, on the other hand, the comments are left as is while potentially drastic changes are made, then the comments become seriously misleading. Not to say comments are bad - but we must all work to make sure the comments that exist stay relevant. -Chris
