Coding Standards. was: a style question

Daniel Mocsny dmocsny at minerva.che.uc.edu
Sun Nov 18 01:11:26 AEST 1990


In article <7267 at hub.ucsb.edu> 6600dt at ucsbuxa.ucsb.edu (David Goggin) writes:
>In article <1990Nov10.191840.21113 at clear.com> rmartin at clear.com (Bob Martin) writes:
>>At Clear we have instituded a style standard which
>>all our engineers follow.
>
>I don't think I'd
>like to have a format forced on me like that.

But by deviating from the standard, you are forcing additional noise
and complexity on everyone who needs to read your code.

Even a fairly poor standard will beat no standards almost every time, 
provided that the poor standard begins with a large-enough share of
the user base. The standard then becomes the language that enables
the users to share ideas with each other. Like any communications
system, the overall value of the system is in direct proportion to the
number of subscribers.

For example, consider the english language (and associated dialects,
such as all the USA varieties). What a mess---hundreds of irregular
verbs, a hopelessly irrational non-phonemic alphabet, an enormous
number of grammatical and pronunciation rules which it violates
constantly, etc. Any person with a shred of logic would understandably
hate to have such a standard imposed on them. The logical person would
chuck this bloated, inconsistent monstrosity and start over with
something simple and elegant, such as esperanto or loglan.

Yet english, with all its obvious warts and shortcomings, is quite
simply THE most valuable language to speak. This does not follow from
any inherent advantage of the language. Rather, it follows from who
happens to be speaking the language. And humans, being such marvelously
adaptive creatures, are quite capable of tolerating the flaws of
english and using it to advantage in spite of them.

If everybody who didn't like the details of the language decided to
change them as they saw fit, what would happen to the language? It
would become worthless. Fragmentation doesn't always kill computer
languages, of course, because the computer can be made to "understand"
any dialect. But fragmentation does reduce the value of a computer
language as a means for communication between programmers. As long as
we insist on creating code of potential value to more than one person,
this will be an important consideration.

> I
>think, however, I _well-designed_ standard does go a
>long way in clearing up the problem.  I would
>reccommend a standard that is thought out carefully
>in advance, to be most logical in showing the
>structure of code, as well as aestheticaly pleasing
>(a big factor for me.)

The situation for programmers is better than for natural-language
speakers, because automated formatting tools can allow individual
programmers some latitude for expression, while still retaining
compatibility with the standard. For example, the details of
indenting belong in a pretty-printing program (or language-sensitive
editor, for that matter). I can think of no reason to impose any
particular indenting style on a programmer, because a quick run through 
a standardizing beautifier will repair any idiosyncrasy.



--
Dan Mocsny				Snail:
Internet: dmocsny at minerva.che.uc.edu	Dept. of Chemical Engng. M.L. 171
	  dmocsny at uceng.uc.edu		University of Cincinnati
513/751-6824 (home) 513/556-2007 (lab)	Cincinnati, Ohio 45221-0171



More information about the Comp.lang.c mailing list