TerseMan challenge

Travis Griggs tgriggs at keyww.com
Tue Jan 11 00:55:03 UTC 2000


Doug Way wrote:

> On Mon, 10 Jan 2000, Bob Arning wrote:
>
> > On Mon, 10 Jan 2000 11:03:28 -0800 Dan Ingalls <Dan.Ingalls at disney.com> wrote:
> > >PS:  FYI, there is already a metric similar to your "bytesOfCode" in
> > the system, called "spaceUsed".  It also takes into account method
> > literals, dictionary overhead and the like, and gets pretty close to
> > the actual overhead (it's used as part of "printSpaceAnaslysis").
> >
> > That's where I stole some of the code ;-). What I was looking for was
> > something that better indicated code complexity than counting carriage
> > returns (and I resisted the temptation of simply removing all the CRs
> > as a joke). Perhaps we could build something that took a number of
> > different measurements and showed them along with some weighted
> > averages. It might be fun to have a "goodness" number for any chunk of
> > code.
>
> At first, I was going to gripe because I thought that bytesOfCode would
> penalize for longer variable/method names, but I see now that it does not.
> (Because it is based on compiled code, not source code.)  Same with
> spaceUsed.
>
> (Although I notice that neither one takes additional instance variables
> into account...)
>
> linesOfCode is pretty worthless as a metric, since it's so easy to cheat
> by removing CRs, combining messages into a single line, deleting comments,
> etc.  I would avoid using it to judge any TerseMan contests.
>
> I came up with my own metric awhile ago called wordsOfCode, which measured
> the number of words (not including comments) in source code, but I'm not
> sure that it would be any better than bytesOfCode/spaceUsed.
>
> Anyway, either one of bytesOfCode or spaceUsed looks like a decent code
> complexity (or "goodness") metric, at least for starters.  It doesn't look
> like there's any way to cheat to get the result reduced artificially.  I
> did some playing around with both metrics, and nothing jumped out at me
> that was unfairly weighted...

Why not count (and compare) parse nodes? One could even come up with a score by
assigning different weights to different node types.

--
Travis Griggs (a.k.a. Lord of the Fries)
Member, Fravenic Skreiggser Software Collective
Key Technology
P-P-P-Penguin  Power!






More information about the Squeak-dev mailing list