Coding Standards. was: a style question

Dan Salomon salomon at ccu.umanitoba.ca
Wed Nov 21 05:13:19 AEST 1990


In article <6741 at uceng.UC.EDU> dmocsny at minerva.che.uc.edu (Daniel Mocsny) writes:
>In article <1990Nov18.005030.28841 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
> > It is also felt that programmers can do a better job of making clear
> > the complete visual layout of a function or file, with the normal
> > attention to detail of a careful programmer\*f.
>
> ... Saying the programmer
> can do a better job at source formatting is equivalent to saying that
> we cannot rigorously define a standardized coding style. A rigorously
> defined style would be suitable for implementing in a beautifier
> and compliance-checking program. If this is not possible, then what
> we call "good program style" must necessarily remain somewhat vague.
>

The real problem is that to prepare the ideal layout for a program the
beautifier would have to:

  (1) Read and understand the comments.  This is especially true
      if the comments label the rows and columns of a table of data
      or expressions.
  (2) Understand the problem being solved, and the method being used.
      Blank lines in code segments can help delineate the steps in a
      computation, and spaces can be used to group related parts
      of an expression.
  (3) Know enough psychology to predict the human response to a layout.
      Layout choices made by a standard can be optimal in the general
      case but suboptimal in specific cases.

All of these factors influence a complete program layout.  It is
still much easier for a programmer to do it while coding than for
someone else to write a beautifier that can do it after the fact for
any program at all.
-- 

Dan Salomon -- salomon at ccu.UManitoba.CA
               Dept. of Computer Science / University of Manitoba
	       Winnipeg, Manitoba, Canada  R3T 2N2 / (204) 275-6682



More information about the Comp.lang.c mailing list