Next: Layout and indentation Up: No Title Previous: A general principle

On arbitrariness and consistency

In many ways the styles that one adopts in programming are arbitrary - there must be many acceptable schemes. However, two points need to be taken into consideration:

We should conclude that we ought to adopt conventional approaches wherever possible. However, the conventional styles often leave some things up to the individual; for example, whether the reserved words in a program are in upper or lower case. In certain contexts there may be ``house rules'' which take away some of this individual freedom.

In all circumstances, whether we are following conventions or are exercising our individual freedom, consistency is very important. For example, if you decide that reserved words are to be in upper case, then you should be scrupulous in the matter. This applies in program design itself as well; for example, if you program a certain kind of task in one part of a program using a particular algorithm, then you should use the same algorithm at each place that that kind of task has to be performed. If things look similar when they are similar then the reader can transfer understanding from one place to another much more easily.



Next: Layout and indentation Up: No Title Previous: A general principle


Simon Jones (sbj@cs.stir.ac.uk)