Xref: utzoo comp.software-eng:2608 comp.misc:7574 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde!uunet!mcsun!ukc!edcastle!lfcs!nick From: nick@lfcs.ed.ac.uk (Nick Rothwell) Newsgroups: comp.software-eng,comp.misc Subject: Re: Coding standards (was Re: Programmer productivity) Message-ID: <1296@castle.ed.ac.uk> Date: 5 Dec 89 12:06:22 GMT Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell) Organization: LFCS Enya Admiration Society Lines: 27 In-reply-to: perry@apollo.HP.COM (Jim Perry) In article <9157@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >Absolutely. Clear code shouldn't *need* a lot of comments; a >programmer should be able to read it and understand what's going on >from the routine names, the variable names, and the flow of control, >with just a few added comments if any. As long as we're forced to use old fashioned low-level languages like C, where it's impossible to express the pure algorithm directly in the target language, there's a need for comments. There are two reasons. The first is that the original algorithm might use concepts which can't be expressed directly in C (higher order functions, or polymorphic data objects, for example). The second is that there has to be some low-level implementation of the things which were assumed as part of the "universe" of the high-level description (e.g. garbage collection). Let me see you write a garbage collector (for example), where it's clear exactly what GC algorithm you're using and what assumptions you're making about the format, storage, invariants of the objects, in C, without comments. Nick. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcvax!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ "You're gonna jump!?" "No, Al. I'm gonna FLY!"