"Good" Code
03-May-90 12:20:32
Sb: #102041-"Good" Code
Fm: Black Belt Systems 76004,1771
To: Thomas Holaday 70407,534
God's compiler, like God, is a myth. But might be as much fun to discuss.
:^)
A c compiler has a number of goals. Obviously, it wants to create an
executable program. We'd like that code to be fast, we'd like it to be
small, although that is becoming a non-issue anymore.. it's not like we're
writing for 32k machines. We'd like the source that is fed to a particular
compiler to be palatable to _other_ compilers, such that if one had an
application on the Mac, for instance, then one could bring it to the Amiga
compilers and get 100% compiles the first time.
A programmer has a number of goals as well. We want the code to be written
in such a way that we can read it now, and read it later. We want OTHER
programmers to be able to read it as well, now and later. Many of us want
the elusive quality of "elegance" also, though I'd hate to be pinned down
on THAT one! We want the code to not only port across compilers, but if it
would go across machines and still function, this is highly desirable, as
it buys more market share. Some programmers, like me, won't do that at the
expense of compromising what they consider an ideal market (The Amiga) but
some, like Borland, would consider that _the_ important issue.
Some of these goals can intersect. For instance, if a programmer codes well
(even elegantly) then the code tends to trend towards the more readable and
maintainable ends of the spectrums. It may make the compilers job easier as
well, by dint of a concise, elegant structure in C may well represent the
same in object.
I'm taking the term compiler here to be limited to exactly what an
assembler does – generate object code, in modular form. I think the term is
becoming somewhat confused with the advent of your 4th gen database users,
and I'm reasonably sure they should be shopping for a new term, so as to
not get entymologically (sp?) all tangled up.
Ben
Amateur Radio Callsign is A A 7 A S