Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!aria!dumbcat!marc From: marc@dumbcat.sf.ca.us (Marco S Hyman) Newsgroups: comp.object Subject: Comments (was Re: Functions without side effects (was Old confusion)) Message-ID: <1064@dumbcat.sf.ca.us> Date: 24 Jun 91 03:14:19 GMT References: <1991Jun21.013944.23970@netcom.COM> <1991Jun23.025529.7749@netcom.COM> Organization: MH Software, Hayward, CA. Lines: 27 In article <1991Jun23.025529.7749@netcom.COM> jls@netcom.COM (Jim Showalter) writes: > I regard most comments as > an admission of failure and/or a design flaw in the implementation > language. ARGGGGHHHHH. (Caution, button being pushed :-) If this is the case then you're reading/writing the wrong kind of comments. Agreed, comments that just explain what's being done contribute nothing. It's the old assembler comment syndrome: sub A,A ; clear accumulator The comment adds nothing. However, comments that explain _why_ something is being done can aid understanding. Something like: // use an inline sort here as there will never be more than // five items to sort. A comment like this can save much time 8 months down the road when someone else is making changes, optimizing, whatever. If you forget things fast (I do!) then the comments can help you remember when you're looking at your own code. This is language independent. // marc -- // home: marc@dumbcat.sf.ca.us pacbell!dumbcat!marc // work: marc@ascend.com uunet!aria!marc