[comp.os.misc] Small is Beautiful

fouts@orville.nas.nasa.gov.UUCP (09/01/87)

In article <1883@encore.UUCP> adamm@encore.UUCP (Adam S. Moskowitz) writes:

> . . ., but why add the size limit?
>Why kill yourself to deal with what many people feel is a bad hardware design?

I do much of my work on a Cray 2.  It has 2 gigabytes of REAL memory.
I still try to write small programs.  (Some are even under a gigabyte
;-)  Seriously, small is something that a reasonable amount of effort
should be put into achieving.  Like most programming credos, it should
be practiced in moderation, rather excess.  When you can do it without
destroying maintainability, you can accomplish:

1) Faster code.  By taking the time to come up with a compact
   algorithm, you can usually find one faster than you were 
   going to use in the first place.

2) Easier to understand code.  This is only true if you try for
   moderation, but less code, if it is well thought out, means
   less to understand when trying to comprehend the program.

3) More useful code.  The more people who can use your code, the
   better off you are.

You can carry the less is more credo to far and get unmaintainable
code.  You can take memory is cheap to far and get unusable code.  As
always in engineering, truth lies in the middle ground, near the
swamp.

Marty

fpst@hubcap.UUCP (09/02/87)

in article <2640@ames.arpa>, fouts@orville.nas.nasa.gov (Marty Fouts) says:
> 1) Faster code.  By taking the time to come up with a compact ...
> 2) Easier to understand code.  This is only true if you try for...
> 3) More useful code.  The more people who can use your code, the
>    better off you are.

The other caveat has to do with not completely confuting the
optimization of the compiler.  As we get further away from von Neumann
architectures, the compiler will become more important as a tool past
the "save me from the detail" genre.  Now one doesn't know where or how
invocation proceeds.

Comments and/or proposals?

-- 
Steve Stevenson                            fpst@hubcap.clemson.edu
(aka D. E. Stevenson),                     fpst@clemson.csnet
Department of Computer Science,            comp.hypercube
Clemson University, Clemson, SC 29634-1906 (803)656-5880.mabell