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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,f292779560fb8442 X-Google-Attributes: gid109fba,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public From: steidl@centuryinter.net Subject: Re: The Last Word on Comments (was Re: Hungarian notation) Date: 1996/06/29 Message-ID: <4r2tsp$3vf@news.ld.centuryinter.net>#1/1 X-Deja-AN: 162777563 references: <31bf6e29.185297643@netline-fddi.jpl.nasa.gov> <31C685A1.F1@wgs.estec.esa.nl> <4q79lr$ju5@panix3.panix.com> <4r1bdp$3ib@nntp.seflin.lib.fl.us> organization: Century Internet reply-to: steidl@centuryinter.net newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel Date: 1996-06-29T00:00:00+00:00 List-Id: In <4r1bdp$3ib@nntp.seflin.lib.fl.us>, z007400b@bcfreenet.seflin.lib.fl.us (Ralph Silverman) writes: >************begin r.s. response************* > > suppose discussion relates to > working code > yes > ? Well, code does not always work, and often comments then become very useful because they reveal the intent of the author, but assuming it actually does work... > source > is determinative of behavior, > certainly, > in a way comments can not be, > yes > ? True, but I have yet do have a comment core-dump on me when I wasn't expecting it ;-) > comments can be wrong in a > ^^^^^ > fundamental way > source is not, > yes > ? Well, given your assumptions, one of which is that the source is *correct*, I guess the source would not be *incorrect*. > on this view comments > are less to be trusted! > (just add common sense!) I think of comments as cache and code as main memory (or disk, depending on how large/old/strange it is). A good comment is like a cache hit. A bad comment is like a cache miss. You don't throw out the cache just because it doesn't always hit - as long as it hits often enough to result in a performance increase. The same goes for comments - if the comments for an entire project are so bad that they waste more time then they save, then its time to redo them (i.e. fill your cache). [Note here that comments only perform like a cache if you correct comments when you find out they are wrong - some programmers *don't* do this, and unwittingly suffer the consequences, over and over again.] > those who have faith in comments > as a shortcut to understanding code > are sure to get burned by this > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > sooner or later... Getting burned is definitely a page-fault, but you still don't throw out the cache. > the argument here is, generally, > between those who have been burned > and those who will be burned!!! I have been burned in the past, I am occasionally burned in the present, I will undoubtedly be burned again in the future. But I still don't throw out the cache. Oh, BTW, a folding editor is another way to increase your cache efficiency. It would be kind of weird to design a computer that had to scan through main memory just to access the cache, yet most editors make you perform a visual scan through the code just to get to the good-stuff (i.e. the comments). [OK, so this analogy is a little weak. It still gets the point across, I think.] Oh, and if you really want to have fun, take the first line of the previous paragraph and use it out of context. -Jeff