RE: Comments in code
"Anderson, Kelly" <[email protected]> Mon, 17 Apr 2006 08:52:42 -0600
| Newsgroups | gmane.comp.misc.free-software-business |
|---|---|
| Message-ID | <[email protected]> |
> Kelly> only by asking=0D=0A> Kelly> the question "what's better t= han a comment here=3F" would one=0D=0A> Kelly> even *begin* to explore = the alternatives listed in this=0D=0A> Kelly> thread.=0D=0A>=20=0D=0A> = He's wrong, about me, at least.=0D=0A=0D=0AI can accept that you would inve= stigate the alternatives, but do you=0D=0Ahave a bias against comments and = in favor of easier to read code=3F=0D=0A=20=0D=0A> My biggest problem in co= ding is getting distracted by=20=0D=0A> elegance and possibilities for refa= ctoring. I've done a fair=20=0D=0A> amount of study of number theory and f= oundations of=20=0D=0A> mathematics (broad and shallow, for fun), and I'll = guarantee=20=0D=0A> you that if I get started on PrimeNumbers the result wi= ll be=20=0D=0A> a PrimeNumbers class with spotty coverage and poor=20=0D=0A= > algorithmic quality, and the original project will go nowhere.=0D=0A=0D=0A= I think that particular idea is overkill, and what's referred to in XP=0D=0A= circles as YAGNI (You Ain't Gonna Need It) which is generally accepted=0D=0A= as a "bad thing".=0D=0A=0D=0A> IMO for this particular case, practicality b= eats purity. =20=0D=0A> Write the comment and move along.=0D=0A=0D=0AYou ma= y have a point for this particular case. I use a lot of comments,=0D=0Athat= doesn't mean I'm comfortable with the fact. Yes, practicality must=0D=0Ata= ke a front seat to get anywhere.=0D=0A=20=0D=0A> Kelly> [more Bill] Tha= t, IMHO is precisely why XP (and more=0D=0A> Kelly> specifically TDD) i= s catching on:=0D=0A>=20=0D=0A> I suspect that they're just plain more fun = than writing good comments.=0D=0A> It will be interesting to see if they're= more productive.=0D=0A=0D=0AThe comment thing is just a small part of TDD.= The bigger parts are=0D=0Areally quite useful and practical. Those being "= write tests first" and=0D=0Ado "incremental improvements to the code under = test". Really good stuff=0D=0Afrom my point of view.=0D=0A=0D=0A-Kelly=0D=0A=0D= =0A=0D=0A=0D=0A=0D=0A=0D=0AE-Mail messages may contain viruses, worms, or o= ther malicious code. By reading the message and opening any attachments, th= e recipient accepts full responsibility for taking protective action agains= t such code. Sender is not liable for any loss or damage arising from this = message.=0D=0A=0D=0AThe information in this e-mail is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access t= o this e-mail by anyone else is unauthorized.=0D=0A