[comp.sources.unix] v20i008: Tools for generating software metrics, Part01/14

rsalz@uunet.uu.net (Rich Salz) (09/20/89)

Submitted-by: Brian Renaud <huron.ann-arbor.mi.us!bdr>
Posting-number: Volume 20, Issue 8
Archive-name: metrics/part01

The C metrics package has been written by Brian Renaud and Richard E.
Cobb, is in the public domain, and may be used by any person or
organization, in any way and for any purpose.

I wrote kdsi as a companion to our "WICOMO" estimating tool.  (The late
Wang Institute's implementation of Boehm's COCOMO model.)  Rick Cobb wrote
the original version of mccabe, which I subsequently modified.  His work
on mccabe inspired me to write the halstead tool and to implement a
metrics project at our company.  I analyzed two projects, a pascal
compiler and a distributed software distribution and control product, both
in the range of 30,000 to 40,000 delivered source instructions.

Brian Renaud   bdr@huron.ann-arbor.mi.us
Huron Systems  {ames, uunet!umix}!sharkey!clip!huron!bdr

               paper: Brian Renaud
                      8419 Berkshire Dr.
                      Ypsilanti, MI 48198
                      USA
---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  README
#	  Rights
#	  Authors
#	  filelist
#	  doc/References
#	  doc/Results1
#	  doc/Results2
#	  doc/halstead.doc
#	  doc/kdsi.1L
#	  doc/mccabe.doc
#	  src/control/README
#	  src/control/altkdsi
#	  src/control/altparse.prs
#	  src/control/example_spec
#	  src/control/gather_stats
#	  src/control/pascal_stats
#	  src/control/proj_stats
#	  src/halstead/Makefile
#	  src/halstead/c_halsfilt.l
#	  src/halstead/c_halsfilt_c
#	  src/halstead/halstead.sh
#	  src/halstead/test.result
#	  src/halstead/README
#	  src/kdsi/Makefile
#	  src/kdsi/kdsi.c
#	  src/kdsi/test.result
#	  src/mccabe/Makefile
#	  src/mccabe/mccabe.sh
#	  src/mccabe/test.result
#	  src/parse.sccs/parse.prs
#	  src/testfiles/test1.c
#	  src/testfiles/test2.y
#	  src/testfiles/test3.c
#	  src/utils/Makefile
#	  src/utils/argfiles.c
#	  src/utils/argfiles.h
#	  src/utils/bdr.h
#	  src/utils/stripcom.c
#	  src/utils/stripstr.c
#	  src/Makefile
#
# ensure that we have the directories we need
#
for dir in doc src src/control src/halstead src/kdsi src/mccabe \
	src/parse.sccs src/testfiles src/utils src/bin
do
	if [ ! -d $dir ]
	then
		echo making $dir
		mkdir $dir
	fi
done
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README
XC metrics package.
X
XWhat's where?
X
X    ./Rights - what you can do with this software
X
X    ./Authors - self-serving drivel
X
X    ./README - you are here
X
X    doc/ - various pieces of documentation, including results of some
X           experiments
X
X    src/ - source for the various tools.  "cd src; make all"
X
XProblems?
X
X    Ugly code.
X
X    Requires N passes over a file (N == number of tools) to completely
X    gather statistics for that file.
X
X    Mccabe uses heuristics to determine start of function.
X
X    Conte, Dunsmore and Shen [see doc/References] suggest that the 
X    halstead "n2" "may be useful in identifying at an early stage those
X    modules most likely to contain errors" (pg 347).  Currently, the
X    halstead model does not print n2.  (This is easy to change, but then
X    you need to change the scripts in src/control.)
X
X    My definition of metrics may differ from other sources.
X
XTodo?
X
X    Someone (hint) should modify the front end of a freely redististributable
X    compiler to deterministically collect all of these statistics in one
X    pass over the source file.
X
X    If you are motivated to do work or have bug fixes, send them to me.
X
XBuilding a better model.
X
X    If you find that these tools assist you in developing or maintaining
X    software, please let me know how.  Also, if you have performed some
X    statistical analysis of interest, please let me know.  If there is
X    general interest, I will be glad to moderate discussions on using
X    software metrics and send out updates and new tools.
SHAR_EOF
chmod 0644 README || echo "restore of README fails"
echo "x - extracting Rights (Text)"
sed 's/^X//' << 'SHAR_EOF' > Rights
XUnless otherwise noted, the following statement applies to the software
Xdistributed in the metrics package.
X
XThe C metrics package has been written by Brian Renaud and Richard E. Cobb,
Xis in the public domain, and may be used by any person or organization, in
Xany way and for any purpose.
X
XThere is no warranty of merchantability nor any warranty of fitness for a
Xparticular purpose nor any other warranty, either express or implied, as to
Xthe accuracy of the enclosed materials or as to their suitability for any
Xparticular purpose.  Accordingly, we assume no responsibility for their use
Xby the recipient.  Further, we assume no obligation to furnish any
Xassistance of any kind whatsoever, or to furnish any additional information
Xor documentation.
X
Xaddress as of August, 1989:
X
X     Brian Renaud:   bdr@huron.ann-arbor.mi.us
X                     {ames, uunet!umix}!sharkey!clip!huron!bdr
X
X     Rick Cobb:      indetech!rec
SHAR_EOF
chmod 0644 Rights || echo "restore of Rights fails"
echo "x - extracting Authors (Text)"
sed 's/^X//' << 'SHAR_EOF' > Authors
XI wrote kdsi as a companion to our "WICOMO" estimating tool.  (The
Xlate Wang Institute's implementation of Boehm's COCOMO model.)  Rick
XCobb wrote the original version of mccabe, which I subsequently modified.
XHis work on mccabe inspired me to write the halstead tool and to implement
Xa metrics project at our company.  I analyzed two projects, a pascal
Xcompiler and a distributed software distribution and control product, both
Xin the range of 30,000 to 40,000 delivered source instructions.
XUnfortunately, failing revenues and disapointing results in the second
Xproject ended the investigation.
X
XIn addition, Marty Leisner (leisner.henr@xerox.com) cleaned up the
Xancient makefiles in the system.  However, any problems you might
Xhave with the makefiles are due to my meddling, not to his efforts.
X
XAddresses:
X
X    Brian Renaud
X    email:        domainish:  bdr@huron.ann-arbor.mi.us
X                  uucp style: {ames, uunet!umix}!sharkey!clip!huron!bdr
X
X    paper mail:   8419 Berkshire Dr.
X                  Ypsilanti, Michigan  48194
X                  USA
X
X    Rick Cobb 
X    email:        indetech!rec
X
X
XBrian Renaud
XAugust 11, 1989
SHAR_EOF
chmod 0644 Authors || echo "restore of Authors fails"
echo "x - extracting filelist (Text)"
sed 's/^X//' << 'SHAR_EOF' > filelist
XREADME
XRights
XAuthors
Xfilelist
Xdoc/References
Xdoc/Results1
Xdoc/Results2
Xdoc/halstead.doc
Xdoc/kdsi.1L
Xdoc/mccabe.doc
Xsrc/control/README
Xsrc/control/altkdsi
Xsrc/control/altparse.prs
Xsrc/control/example_spec
Xsrc/control/gather_stats
Xsrc/control/pascal_stats
Xsrc/control/proj_stats
Xsrc/halstead/Makefile
Xsrc/halstead/c_halsfilt.l
Xsrc/halstead/c_halsfilt_c
Xsrc/halstead/halstead.sh
Xsrc/halstead/test.result
Xsrc/halstead/README
Xsrc/kdsi/Makefile
Xsrc/kdsi/kdsi.c
Xsrc/kdsi/test.result
Xsrc/mccabe/Makefile
Xsrc/mccabe/mccabe.sh
Xsrc/mccabe/test.result
Xsrc/parse.sccs/parse.prs
Xsrc/testfiles/test1.c
Xsrc/testfiles/test2.y
Xsrc/testfiles/test3.c
Xsrc/utils/Makefile
Xsrc/utils/argfiles.c
Xsrc/utils/argfiles.h
Xsrc/utils/bdr.h
Xsrc/utils/stripcom.c
Xsrc/utils/stripstr.c
Xsrc/Makefile
SHAR_EOF
chmod 0644 filelist || echo "restore of filelist fails"
echo "x - extracting doc/References (Text)"
sed 's/^X//' << 'SHAR_EOF' > doc/References
XPreface:  If you have expertise in metrics and/or formal estimation models
Xyou will no doubt find my comments annoyingly inane.  Save the stress on
Xyour cerebral arteries; stop reading now.  If however, you are a tadpole of
Xsoftware engineering, you may find some of these references useful.
X
XVarious books and articles I have run across which discuss various software
Xengineering metrics:  (software tools relevant to the area in parenthesis)
X
X
XFor all aspects of software engineering and software engineering metrics:
X
XA1.	S.D. Conte, H.E. Dunsmore, V.Y Shen, _Software Engineering
X	Metrics and Models_, The Benjamin/Cummings Publishing Company, Inc.,
X	Menlo Park, California, 1986.
X	[Nicely done.  You should have this book if you are interested
X	in SE metrics/models]
X
XA2.	Edward Yourdon, editor, _Classics in Software Engineering_,
X	YOURDON Press, New York, New York, 1979. 
X
XA3.	Edward Yourdon, editor, _Writings of the Revolution: Selected
X	Readings on Software Engineering_, YOURDON Press, New York,
X	New York, 1982. 
X	[All (well, many) of those landmark articles from the '60s and '70s
X	that are frequently sited, but unavailable to those of us without
X	thirty year journal collections are in these two books.  I'd
X	suggest that you buy them if they are still in print.]
X
XA4.	Tom DeMarco, _Controlling Software Projects: Management,
X	Measurement and Estimation_, YOURDON Press, New York, New York,
X	1982.
X	[A very good book! Lots of ideas and cheerleading for developing
X	your own organizational metrics.  The algorithm for the halstead
X	tool I wrote was extracted from an appendix of this book.]
X
XA5.	Londeix, Bernard, "Cost Estimation for Software Development",
X	Addison-Wesley Publishing Company, 1987 (ISBN 0-201-17451-0)
X	[I've bought it, but haven't had time to read it.  Primary
X	focus is on the Putnam model.]
X
XA6.	Zuse, Horst and Bollmann, Peter, "Software Metrics: Using Measurement
X	Theory to Describe the Properties and Scales of Static Software
X	Complexity Metrics", ACM SIGPLAN Notices Vol. 24, No. 8 (August 1989)
X	[Discusses limitations on how various complexity measurements
X	can be used.  Probably applicable to all metrics.  Very interesting,
X	although difficult reading for someone of my limited mental abilities.]
X
X
XModels based on source lines of code (kdsi - COCOMO) and function points
X
XB1.	Barry W. Boehm, _Software Engineering Economics_, Prentice-Hall,
X	Inc., Englewood Cliffs, NJ, 1981.
X	[A "must have" book.]
X
XB2.	Allan J. Albrecht and John E. Gaffney, Jr., "Software Function,
X	Source Lines of Code, and Development Effort Prediction: A Software
X	Science Validation", IEEE Transactions on Software Engineering
X	Vol. SE-9, No. 6 (November 1983).
X
XB3.	Charles A. Behrens, "Measuring the Productivity of Computer
SHAR_EOF
echo "End of part 1"
echo "File doc/References is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0


-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.