Efficient coding considered har

joe at modcomp.UUCP joe at modcomp.UUCP
Mon Nov 21 14:17:00 AEST 1988


Steve Summit (scs at adam.pika.mit.edu) writes [slightly edited]:

> There is an abominable quantity of horrible code in existence today, and
> egregious amounts of time are wasted trying to fix neverending bugs, trying
> to add seemingly reasonable features which the "architecture" inexplicably
> prohibits, and finally abandoning the whole mess and rewriting it from
> scratch.

I agree completely.

> I will be vehemently disagreed with, but I submit that most of this
> unmaintainable code arises out of misplaced concerns for "efficiency."

Some of it, yes, is produced by otherwise good programmers with misguided
notions of what is important.  However, my experience has been that most bad
code comes from bad programmers.  These fellows don't try to put "efficiency",
or anything else, into their code.

> It is true that there are a lot of miseducated programmers out there, but
> their miseducation often derives from teachers and textbook authors who
> constantly harp on efficiency without teaching moderation, and from the
> badly-written code by which they are surrounded and which they (the
> students) inevitably emulate and go on to perpetuate.

I'm not sure if the swarms of bad programmers are due to miseducation.
Certainly, my teachers didn't harp on efficiency issues; there just wasn't
enough classroom hours to do that and also get the basic concepts across.
Rather, a lack of excitement for the field, a mismatch of skills, perhaps
due to the selection of a career based on paycheck rather than interest, may
be the more important factors.

Of course, it doesn't help that the problem of writing truly maintainable,
flexible code is one of the most challenging and creative things available
to the working programmer.  I suspect that none but the best of us will ever
be very good at it, at least, not until the "general principle of creativity"
has been discovered and reduced to a rule of thumb (:->).

> When assigning priorities, though, I would rather have people learn clarity
> and good style first, and efficiency as the need arises.  (Among other
> things, the marketplace imperatives of which we are endlessly reminded will
> ensure that efficiency will not be neglected; while there are, sadly, not as
> many incentives for writing clearly.) The industry is not plagued by slow
> programs (compilers being tuned for the benchmarks to the contrary
> notwithstanding).  The industry is plagued by software that is over
> schedule, over budget, buggy, and unmaintainable.

Right on the mark.  No one could have said it better.

Joe Korty
uunet!modcomp!joe



More information about the Comp.lang.c mailing list