C Programming Style -- New thought ("writing code")

Thomas M. Breuel tmb at talcott.UUCP
Fri Jul 26 15:27:38 AEST 1985


> > General question: does anybody "write code" on paper first any more?
> 
> Probably not many (except in DP shops that are way behind the times),
> in the sense of preparing code that can then be transcribed by a
> "keypunch operator".  I have seen a lot of people who should know
> better try to DESIGN their code while they are entering it..

Several computer scientists have come up with program design languages.
They are usually derived from programming languages like ALGOL or PASCAL
and (well, they can't enforce it anyway) allow a lot of syntactic and
semantic freedom, but are intended to cause you to think of your problem
in a structured manner. You can basically do the same thing by using
your favourite programming language and mixing it with natural language,
e.g.:

	while(there are still elements in the set) {
		pick an element;
		check for membership in exclusion set;
		if(not member of exclusion set) {
			...

There have been many attempts at enabling people to do program design
at the terminal, but none of them were really successful. A programming
language called 'ELAN', for example, was designed for (interactive)
top-down programming by allowing you to specify your programs in a
mixture of natural language and PASCAL, and then to resolve the natural
language parts by macro expansion. Object oriented systems and LISP
machines are other such examples of programming environments that are
supportive of interactive program design.

A good programming environment and a suitable language can help to make
interactive program design less of a disaster; most of the time the
results are pretty awful, though (look at UN*X sources -- at least I
think that that's what's wrong with them). 

It is very tempting just to sit down and 'hack something together', 
in particular if you are writing in 'C' on a UN*X system, but
if you really care about a program, I would recommend to sit down and
think about it for a long time, start scribbling ideas on paper, and
gradually try to implement this or that module. Often you still need
several tries to get it right.

					Thomas.



More information about the Comp.lang.c mailing list