[comp.lang.forth] Granularity of Forth Programs

pl@UUNET.UU.NET (Pedro Sanchez) (01/24/91)

I was wondering of what would be the ideal granularity of Forth programs.

Certainly we can define several ways of measuring such granularity.
A possible measure could be the mean number of words in the definition of
the several words that compound a given program.

I would like to know from you guys any comments about this subject, and
what are your views regarding the following:

1.   What is (should be) the mean number of words non primitive word
 definitions?
2.   What is (should be) the mean number of machine instructions in a primitive
 word?
3.   Are your numbers based on guesses, personnal belief, or actual measured
 data?

I will summarize the results to the list.

Thanks.
                        Pedro.
==========================================================================
Pedro Luis Prospero Sanchez      internet: pl@vme131.lsi.usp.ansp.br
University of Sao Paulo          uunet:    uunet!vme131!pl
Dept. of Electrical Engineering  hepnet:   psanchez@uspif1.hepnet
phone: (055)(11)211-4574  home: (055)(11)215-6492 fax: (055)(11)815-4272
==========================================================================

koopman@a.gp.cs.cmu.edu (Philip Koopman) (01/27/91)

In article <9101241516.AA11654@ucbvax.Berkeley.EDU>, vme131!lsiserv1!pl@UUNET.UU.NET (Pedro Sanchez) writes:
> I was wondering of what would be the ideal granularity of Forth programs.

According to Miller, the magic number for anything having to
do with human thinking is 7 +/- 2.
So (combining with some other theories), there should be
seven "chunks" per Forth word.  Roughly, each Forth word
should also correspond to one chunk (except multiple words
used for a single control structure can be grouped as a
single chunk) to factor the code appropriately.
And, importantly, control structures should seldom be
nested, and never more than 2 deep.

Alternately, a rule of thumb among many in the Forth community
is ten words inside a colon definition.

  Phil Koopman                koopman@greyhound.ece.cmu.edu   Arpanet
  2525A Wexford Run Rd.
  Wexford, PA  15090
*** this space for rent ***