home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!huxley!tal691
- From: tal691@huxley.anu.edu.au (Tonio Loewald)
- Newsgroups: comp.lang.c
- Subject: A Modest Proposal
- Date: 11 Nov 92 01:43:22 GMT
- Organization: Australian National University
- Lines: 65
- Message-ID: <tal691.721446202@huxley>
- References: <1992Oct29.085752.25264@pilhuhn.ka.sub.org> <Bx3KFK.7Er@cdsmn.mn.org> <560@ulogic.UUCP>
- NNTP-Posting-Host: 150.203.2.12
-
- >>As for comments, I don't count them as LOCs because the bulk of
- >>meaningful documentation is not in the code itself, but in
- >>separate documents where I can incorporate drawing to help explain
-
- My modest proposal is that a programmer SHOULD count lines of comments
- towards the mystic productivity value (whatever it is). Sure, you
- can argue (as shown below) that TOO MANY COMMENTS can be a bad
- thing. But, so can TOO MUCH CODE (or, in the case of some programmers,
- *any* code).
-
- Whether you count comments separately from "real" code is a separate
- issue. You could start discounting simple assignment statements
- or counting lines involving nested function calls with casting as
- either 2 lines of code or -10 lines of code depending on your
- outlook. Or defining 10 lines of assembler as 3 lines of "code"
- or whatever.
-
- The important point is that if you DON'T count comments, that
- means that you don't think of them as VALUABLE. This reflects
- a dangerous mindset.
-
- >Code/comment ratio shows how well documented the code is. A low
- >ratio you may have been spending more time explaining what you were
- >doing than doing it. A high ratio may mean that it would be hard
- >for someone else to jump in and do maintenance.
-
- Again -- I don't think this is any more true than saying that if
- there's a lot of code, the program must be badly written. Sometimes
- a single assignment statement needs a LOT of documentation. (Eg.
- "don't touch this assignment statement unless you FULLY understand
- what it does. A synopsis follows...")
-
- Simple arithmetic can't tell good comments from bad any more than
- it can tell good code from bad.
-
- Anyone out there using WEB like to comment on any of this?
-
- >Each of these values were based on my whim of what I thought might
- >be useful. No flames on "that one is useless" please. However, I
- >am certainly open to suggestions about other metrics to add to the
- >summary. :)
-
- >I process #if/#else/#endif for literal values (1 or 0) and
- >(if I remember properly, it's been a while) single level symbolic
- >interpretations (#define DEBUG 1/#if DEBUG) but not yet for compound
- >(#if 1 || DEBUG).
-
- >I consider conditionaly compiled out code important because you
- >DID spend time developing that debugging code, and it may be
- >useful in the future if you #if it back in.
-
- >Sorry, but I don't (currently) handle lines consisting of "{" or "}" alone
- >(with or without comments) as anything other than a line of code, but perhaps
- >I should include that sort of thing.
-
- Interesting to consider the effects on programmer "productivity" of using
- different languages, formatting, naming conventions, and so on.
-
- Tonio
-
- --
- Tonio Loewald | Ph 06 290 1594 | 13 Sabine Cl. Garran
- tal691@huxley.anu.edu.au | Fax 06 290 1595 | ACT 2605 AUSTRALIA
- "You can lie/You can cry/For all the good it'll do you, you can
- die/But when it's done/And the police come/And they lay you down
-