Subject: RE: Comments in code
From: "Anderson, Kelly" <KAnderson@dentrix.com>
Date: Mon, 17 Apr 2006 08:52:42 -0600

 Mon, 17 Apr 2006 08:52:42 -0600
>     Kelly> only by asking
>     Kelly> the question "what's better than a comment here?" would one
>     Kelly> even *begin* to explore the alternatives listed in this
>     Kelly> thread.
> 
> He's wrong, about me, at least.

I can accept that you would investigate the alternatives, but do you
have a bias against comments and in favor of easier to read code?
 
> My biggest problem in coding is getting distracted by 
> elegance and possibilities for refactoring.  I've done a fair 
> amount of study of number theory and foundations of 
> mathematics (broad and shallow, for fun), and I'll guarantee 
> you that if I get started on PrimeNumbers the result will be 
> a PrimeNumbers class with spotty coverage and poor 
> algorithmic quality, and the original project will go nowhere.

I think that particular idea is overkill, and what's referred to in XP
circles as YAGNI (You Ain't Gonna Need It) which is generally accepted
as a "bad thing".

> IMO for this particular case, practicality beats purity.  
> Write the comment and move along.

You may have a point for this particular case. I use a lot of comments,
that doesn't mean I'm comfortable with the fact. Yes, practicality must
take a front seat to get anywhere.
 
>     Kelly> [more Bill] That, IMHO is precisely why XP (and more
>     Kelly> specifically TDD) is catching on:
> 
> I suspect that they're just plain more fun than writing good comments.
> It will be interesting to see if they're more productive.

The comment thing is just a small part of TDD. The bigger parts are
really quite useful and practical. Those being "write tests first" and
do "incremental improvements to the code under test". Really good stuff
from my point of view.

-Kelly





E-Mail messages may contain viruses, worms, or other malicious code. By reading the
message and opening any attachments, the recipient accepts full responsibility for taking
protective action against such code. Sender is not liable for any loss or damage arising
from this message.

The information in this e-mail is confidential and may be legally privileged. It is
intended solely for the addressee(s). Access to this e-mail by anyone else is unauthorized.