[comp.sys.xerox] Lisp code metrics

Gocek.henr@XEROX.COM (06/23/89)

Has anyone done any work on calculating metrics for existing lisp code, or
lisp code to be developed?

My group has done some number crunching on individual functions.  We've
looked at the length of the funtion, and at various ways to calculate the
depth of forms within the function definition.  The Interlisp function
COUNT has proven useful, since it's built in, but I've also looked at the
maximum and average depth of the function definition.  The depth is related
to counting parentheses.

One idea is to look at external references, possibly using Masterscope.
Packages that generate GRAPHER graphs are probably more complex than
packages that calculate loan interest.

We haven't yet dealt too much with branching factors and conditionals.
User interactions are worth considering, as are global variable usage and
total length of a system.

The purpose is primarily to estimate the maintenance costs associated with
our software.  We might also use the metrics to indicate candidates for
code revisions, i.e. when a function's complexity is greater than some
magic value, split it into two functions, etc.  And if we had decent specs
and designs, we could estimate development time.

I have information on source code analysis in general, so I'm really
looking for lisp specific applications, but any comments you have would be
appreciated.

Thanks,
Gary Gocek  -  Gocek.Henr@Xerox.COM
Xerox Corporation
1350 Jefferson Road
Mail code: 0801-27C
Rochester, NY 14623
716-427-1857