Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site frog.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!cybvax0!frog!john From: john@frog.UUCP (John Woods) Newsgroups: net.lang.c Subject: Re: C Programming Style -- New thought ("writing code") Message-ID: <241@frog.UUCP> Date: Thu, 25-Jul-85 13:35:19 EDT Article-I.D.: frog.241 Posted: Thu Jul 25 13:35:19 1985 Date-Received: Sat, 27-Jul-85 02:02:41 EDT References: <418@spar.UUCP> <408@utastro.UUCP> Organization: Charles River Data Systems, Framingham MA Lines: 39 >>I find that one of the things that most affects my personal choice of >>program-formatting style is the number of lines on the console I work at. >>Most of my C coding is done sitting in front of old-style displays of 24 by >>80 lines. > > I assume this means you "write code" directly at a terminal, using a text > editor, instead of the "venerable, traditional" way of writing it on paper > first, with a pencil (and a *large* eraser), and then entering the stuff > aftwerwards. > > General question: does anybody "write code" on paper first any more? > Yes. I prefer to, because it matches the way I think better. However, this (I feel) *increases* my desire for terseness. Additionally, once I have typed something in, I am more comfortable staring at hardcopy that a terminal screen. But once again, the more that is packed onto the page READABLY, the better I like the code (and remember, you can't run GREP(1) on paper (yet)). As an example: the recent BYTE article on the TRAVESTY program (a few months back) included a PASCAL program with a doubly nested loop, which had to use a logical variable to escape from the inner one (I believe that that required a double test in the while). I recoded it in C, and came up with half the number of lines, SIMPLIFIED IT TO A SINGLE LOOP using "C ``tricks''", and came up with what I felt was vastly more readable code: the whole function "fit in my mind" at once. The PASCAL program was not necessarily badly written; it was probably textbook quality (not saying much :-). However, readability is in the eye, and the mind, of the beholder. Who would you rather listen to, someone who gives an hour-long speech in the 1000-word Basic English subset, or someone who uses the full power of English to eloquently say the same thing in 5 minutes (without using archaic words not in use for 300 years, note)? -- John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101 ...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc@MIT-XX.ARPA