Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.misc Subject: Re: Structured Programming (shading into Computer Folklore) Message-ID: <447@lakart.UUCP> Date: 28 Feb 89 15:17:49 GMT References: <16129@mimsy.UUCP> Organization: Lakart Corporation, Newton, MA Lines: 67 From article <16129@mimsy.UUCP>, by chris@mimsy.UUCP (Chris Torek): > In article <1348@ubu.warwick.UUCP> mirk@warwick.UUCP (Mike Taylor) writes: >>Hmmm ... A few years ago BASIC was all I had, structured programming >>was a closed book to me, and yet I seemed to get by without any of the >>sorts of problems that Structured Programming is supposed to alleviate. >>I will admit I never wrote a 10000-line BASIC program, but I certainly >>got into the 1000s .... But looking at it objectively, I never had as >>much difficulty debugging my huge, sprawling unstructured BASIC programs >>as I do now debugging my huge, sprawling, but structured, C programs. >>(Only 1/2 a :-) > > Despite the near-necessities missing from most BASICs---local > variables, for instance---it is possible to write large programs in > them. I once (in 1979 or 1980, I suppose) wrote a Z80 assembler in > TRS-80 Model I Level II BASIC. The line count was certainly greater > than 1000. The system I used was to keep a large sheet of paper > covered with entry points and variable use. In fact, I still have that > paper (curious what one finds in the desk drawers under the H19): > ... > 10200 - Line input & parsing > ... > 11200 - O1$: "BC" RP <- 0, "DE" RP <- 1, "HL" RP <- 2, > "AF" RP <- 3, "IX" 4, "IY" 5, else -1 > ... > 12100 - Label table search, FI = `subscr' for label (*not* mod 25) > ... > 12400 - write 1 disk record, C bytes > ... > (many of these comments now seem unutterably cryptic; but some of it > comes back to me now). In a book that has basic programs for the TRS80, the author makes the following comment (not verbatim, but the meaning is the same) "You do not need a structured programming language (like PASCAL) to write structured programs. You need discipline: write all your subroutines, give them entry and exit points and conditions and variable, comment your loops, and if's ....." Is there any _REAL_ difference between: while (a < 25) { ..... } AND: 100 REM start "while A < 25" loop 110 if A >= 25 then goto 200 120 ..... 190 goto 110 200 REM exit "while A < 25" loop Local variables are perhaps the hardest problem to solve, but careful variable name chosing goes a long way. Recursion, I will admit, is a problem. But it _CAN_ be done, you just need to do a lot of legwork in software, and your stack space is only as big as you make it. -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+