Ah, but tests are testable (the code tests the tests and the tests test the 
code; if your tests have a bug in it, they will fail, you will figure out 
it's not your code, and thus, your test). Put differently, if your test 
becomes 'out of date', you will notice. If a comment becomes 'out of date', 
it'll remain there and just confuse the heck out of any future readers.

You're basically advocating comments that are like '// add 1 to a'. Which I 
think we can all agree is not, in fact, a good idea.

On Tuesday, April 30, 2013 8:16:39 PM UTC+2, Vince O'Sullivan wrote:
>
> On Monday, 15 April 2013 07:38:03 UTC+1, brucechapman wrote:
>
>>  If what we write first is "the simplist thing that might work", then 
>> I'd suggest comments should explain code that is not apparently the "the 
>> simplist thing that might work". or "comments should explain why the 
>> simplistic thing that might have worked, didn't"
>>
>
> Unfortunately, code that the developer has stripped bare, in order to make 
> it more "simple", is rarely code in a form that is most useful to someone 
> who has to maintain it in the future (including when that someone is the 
> same person and "the future" might only be days later).
>
> Comments are (or, at least, ought to be) good precisely because they are 
> redundant.  Error checking is only possible when redundancy is present.  If 
> the comments and the code match, our confidence in it increases; if not, it 
> decreases.  Unit tests work in the same way.  They are redundant code - 
> often bigger and more complex than the code under test - in that they are 
> written but not shipped (just as comments are written but not executed). 
>  Nevertheless, no one would suggest that removing tests would be a good 
> thing because it would make the overall code base simpler.
>

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to javaposse+unsubscr...@googlegroups.com.
To post to this group, send email to javaposse@googlegroups.com.
Visit this group at http://groups.google.com/group/javaposse?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to