From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,ec5e801e70a0a8f1 X-Google-Attributes: gid109fba,public X-Google-Thread: 101deb,ec5e801e70a0a8f1 X-Google-Attributes: gid101deb,public X-Google-Thread: 103376,ec5e801e70a0a8f1 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public From: Robert Barnes Subject: Re: Should I learn C or Pascal? Date: 1996/07/30 Message-ID: <31FD4510.4150@voyager.co.nz>#1/1 X-Deja-AN: 170912690 references: <4t6hrs$kid@goanna.cs.rmit.edu.au> content-type: text/plain; charset=us-ascii organization: Self Employed mime-version: 1.0 newsgroups: comp.lang.c,comp.lang.c++,comp.lang.ada,comp.lang.pl1 x-mailer: Mozilla 2.01 (Win95; I) Date: 1996-07-30T00:00:00+00:00 List-Id: ++ robin wrote: > > dewar@cs.nyu.edu (Robert Dewar) writes: > > >"An algorithm is just a set of instructions on how to accomplish a task. An > >algorithm does not depend at all on any sort of programming "language".True, but the way that you express an algorithm is at least partly conditioned by your proposed implementation. Not that there's anything wrong with this IMHO. I used to use a mixture of PL/I and English - where PL/I was at least as concise, then I saw no point in writing "English" just to be "Not a programming language". Similarly, if you're going to be expressing in C, or Pascal, or whatever. The rule for pseudocode should be "use the clearest communication to your audience". Who is your audience? Yourself, and your collegues. There needs to be some degree of consensus with your collegues (= documentation standards), but these needn't be rigid. If your task was doing something with valid account data (let's assume that this is properly understood in this context), then in my programming group I'd have allowed forms such as:- DO for every valid account xxxxx ENDDO and FOR EVERY valid account DO xxxxx END and variations on these - LOOP, FOR ALL, WITH EACH ... whatever. As long as it's clear and unequivocal. Pseudocode should summarize. Thus in the example given:- > > > Loop until variable is equal to 7 > > Add 1 to variable > > Print out the following string to screen: ;-) > > end of loop > the introduction of "variable", is unnecessary, and has only added to the confusion. Hence the subsequent discussion which has generated more heat than light. In fact, like Robin, at this level I'd have written the PL/I directly, but if I did feel the need for pseudocode (because there was some real complexity to the logic within the loop), I'd probably have written something like:- DO 7 times xxxx The whole point about successive refinement is to avoid getting bogged down in detail that is irrelevant to the level that you're designing.