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: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Hungarian notation Date: 1996/05/24 Message-ID: #1/1 X-Deja-AN: 156562766 references: <31999F43.41C67EA6@scn.de> <4o07o9$rfu@seagoon.newcastle.edu.au> <4o1vo3$p2a@news1.ni.net> organization: The World Public Access UNIX, Brookline, MA 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: In article , Robert Dewar wrote: >IWell, I guess they just don't want to comment the code and don't come to ask >you question anymore. I'm a student in CS, and I know what the students feel. > When the project is dued soon and don't get the program works, do you still >have time to comment to code?" > >On the contrary, my students know that working code is useless to hand in >if it is not commented, so they *have* to comment the code. In fact a >well-commented and well-designed but not quite working assignment gets >much more credit than a fully working program which is poorly designed, >or has incomplete or incomprehensible comments. Well, I'm not an ivory-tower academic like Robert is (*), but I very much agree with this strategy. The thing people have to learn is that comments actually help you get the code to work right. Comments are not just a chore that silly professors require. Somebody who says, "I don't have time to write all those comments" is missing the point. >In the case of Ada package specs, comments *are* part of the spec, they >are as important as the code itself. It is remarkable how students react >if they know that this is the ground rule. All my students this semester >did a good job of commenting code! Well, that's not too surprising, but it doesn't prove anything. My first-grade teacher required that I put my name on the upper-left-hand corner of the page. I didn't learn that "In civilized society, it's right to put one's name on the upper-left-hand corner of the page." I learned, "To satisfy this teacher, I need to put my name on the upper-left-hand corner of the page." And I did it. But my second-grade teacher demanded that I put my name on the upper-RIGHT-hand corner. How do you convince students that comments are actually *useful*, and actually make it *easier* to write programs? It's hard, since it's not true for small programs. I once read an article by some professor who had written a program that judged the "style" of programs submitted for assignments. He judged this program a success, because after some time, students' programs did in fact get better style ratings, according to this style-judging program. Circular reasoning. (The program counted the number of lines of comments per line of code, the average length of identifiers, and so forth.) - Bob P.S. (*) I hope Robert realizes I'm kidding about "ivory-tower academics". ;-) He has, in fact, participated in professional programming projects. P.P.S. My take on comments is: Comment (only) where necessary. Whenever you can express some fact in the programming language, it's better to do that than to write a comment. Any time you feel the need to write a comment, that's a failure of the programming language -- it can't express what you need to say. Note that lower-level languages need more comments than higher-level languages. But we're very far from having programming languages that can express everything that needs to be said. So we badly need comments.