From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,f292779560fb8442 X-Google-Attributes: gid109fba,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public From: jdege@winternet.com (Jeff Dege) Subject: Re: Hungarian notation Date: 1996/05/24 Message-ID: <4o3437$6vd@blackice.winternet.com>#1/1 X-Deja-AN: 156415679 references: <31999F43.41C67EA6@scn.de> <319D2278.3F9A@netonecom.net> <4nr50r$jo2@ringer.cs.utsa.edu> <4ns02o$ep3@goanna.cs.rmit.EDU.AU> <4o07o9$rfu@seagoon.newcastle.edu.au> followup-to: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel organization: StarNet Communications, Inc newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel Date: 1996-05-24T00:00:00+00:00 List-Id: On 23 May 1996 07:40:11 -0400, Robert Dewar (dewar@cs.nyu.edu) wrote: : In fact the anti-comment attitude comes from the trenches rather than from : the ivory tower. The main argument seems to be that since no one can ever : manage to maintain comments properly, it is better to have no comments, or : at least to minimize comments. I strongly disagree, and feel that it is : better still to keep the comments up to date. A bad comment is a bug, as : serious as any other latent bug in the "real" code, and programmers have : to start thinking that way. I see absolutely no gain from insisting on useless comments, and most of the comments I see are useless. The code is a complete specification of what the program is doing, and duplicating any of that information is pointless. What the code doesn't specify is _why_ the code is behaving in a certain way. _That_ is what needs to be commented. But I've seen code that was well more than half comments that left me with no idea as to what the code was supposed to do, let alone why it was written in a certain way. But these are the questions that the maintenance programmer is going to ask. : Yes of course it is hard to keep comments up to date -- there are many : hard things about programming, this is one of them. I find that comments about the purpose of code becomes obsolete much more slowly than comments about what the code is doing. : To me good comments are essential, the code can only tell you what it does : and how at a level of abstraction matching the code. Good comments tell you: : : a) what the code is doing at a higher level of abstraction : b) why you did what you did : c) why you didn't do something else : : obviously code cannot be self-documenting in these three aspects. Exactly. -- Friendship is born at that moment when one person says to another: "What! You, too? Thought I was the only one." -C.S. Lewis