Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site eagle.UUCP Path: utzoo!watmath!clyde!burl!ulysses!eagle!mjs From: mjs@eagle.UUCP (M.J.Shannon) Newsgroups: net.lang.c Subject: Re: C Programming Style -- New thought ("writing code") Message-ID: <1295@eagle.UUCP> Date: Thu, 25-Jul-85 09:21:22 EDT Article-I.D.: eagle.1295 Posted: Thu Jul 25 09:21:22 1985 Date-Received: Fri, 26-Jul-85 08:21:24 EDT References: <418@spar.UUCP> <408@utastro.UUCP> Organization: AT&T Bell Laboratories, Summit, NJ Lines: 26 > General question: does anybody "write code" on paper first any more? > -- > Ed Nather I used to "do it" on paper as recently as a year or so ago, but have succumbed to the paperless age. For new programs, I now take a top-down approach, entering a skeletal main() which either mucks with arguments itself or calls a routine to do so. Then it calls the main function of interest. This routine is then coded as was main(), mostly a skeleton detailing the algorithm, with functions called for operations I haven't yet defined. At this point, most of the data structures are defined (modulo choices of storage management, such as whether to use arrays, linked lists, quadtrees, etc.), since I've outlined the algorithm sufficiently to understand what data types are involved. My experience with this method indicates that main() only changes to account for changes in options or dealing properly with multiple file arguments, etc. As I discover "holes" in the algorithm, appropriate code is added, then the low- level routines I used are defined. I find this to be a rather effective method for constructing programs -- more so than pencil & paper because I can see the current version of the algorithm (usually on one screen) without having to decipher my illegible scribbling over holes in the paper (from excessive erasing). Hope this helps some of you out there. It has helped me (the method, not this posting!). Comments appreciated, flames ignored. -- Marty Shannon UUCP: ihnp4!eagle!mjs Phone: +1 201 522 6063