home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:16047 comp.software-eng:4167 comp.sys.mac.programmer:18055
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!decwrl!netcomsv!ulogic!hartman
- From: hartman@ulogic.UUCP (Richard M. Hartman)
- Newsgroups: comp.lang.c,comp.software-eng,comp.sys.mac.programmer
- Subject: Re: Productivity of a C programmer ?
- Message-ID: <560@ulogic.UUCP>
- Date: 5 Nov 92 23:35:56 GMT
- References: <1992Oct29.085752.25264@pilhuhn.ka.sub.org> <Bx3KFK.7Er@cdsmn.mn.org>
- Followup-To: comp.lang.c
- Organization: negligable
- Lines: 66
-
- In article <Bx3KFK.7Er@cdsmn.mn.org> wells@cdsmn.mn.org (Rich Wells) writes:
- >
- >I use a very conservative means of measuring LOCs. Blank lines do
- >not count, lines with just a bracket do not count, and comments
- >do not count. When I count lines of code, I count just lines of
- >real code. In my case, this means about 1/4 of the lines in a
- >source file count as LOCs. Bummer. I don't measure LOCs for
- >productivity bragging rights, I do it to get a useful measure.
- >
- >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
-
- I have a program for counting lines of code that produces a summary
- that includes the raw data:
-
- # lines of active code
- # lines of code conditionally compiled out (see above)
- # lines of comments
- # blank lines
- # lines total
-
- and some derived "scores" (my own opinons, not from any book
- on software analysis or anything):
-
- code density = (nActive / nTotal) * 100;
- text tensity = 100.0 - ((nBlank/nTotal)*100)
- code/comment ratio = (nActive / (nActive+nComments)) * 100
-
- (all calculations done in floating point).
-
- Code density is what percentage of the file is "real" code.
-
- Text density shows how readable the format is (no spaces
- between separate routines, major blocks of code, comments, etc gives
- a high density i.e. "wall of text" effect).
-
- 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.
-
- 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.
-
- -Richard Hartman
- hartman@ulogic.COM
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- I am just a figment of your imagination...
- ...what does that say about *your* mental health?
-