🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1384

SP as "no goto's and nice indentation"

#1384
From: Magnus Olsson
Date: Mon, 30 Jul 1990 09:25
56 lines
3035 bytes
Much of the recent debate/flame-war about the pros and cons about structured 
programming (SP) has centered around what could be described as

"Dogmatic CS instructors who believe that good programming is the same
 thing as following a rigid set of rules, such as
 'Thou shalt not make use of GOTOs'
 'Global variables are EVIL and must be avoided at all cost'
 'Thou shalt indent your program in the way I like'
 'Thou shalt never put more than one Pascal statement on a line'
 'Thou shalt never write a procedure that doth not fit onto a page'
 and so on."
 
While I think that this caricature is not representative of most CS people
today, I do know that there actually are people who believe that SP is the
same thing as not using goto's and indenting your source code. This
attitude is not confined to one camp - lots of the detractors of SP seem to
share the same misconception (perhaps that's why they don't like SP in the
first place!). 

[Of course, although indentation makes a program more readable, and
excessive use of GOTOs destroys your program structure, SP really is about
organising the flow of control *and* data in a logical way. The current
emphasis in SP teaching (at least here in Lund) seems to be on "information
hiding" and modularity, like in Modula 2 and Ada, or object oriented
programming.] 


Now, this makes me wonder,

Where and when did these rules (about indentation, global variables,
one statement per line, no GOTOs etc) originate? 

Indentation is, of course, as old as Algol, but the emphasis on readablity
seems to be later. I read a classical Swedish Algol textbook from the
mid-sixties (by Ekman and Froberg, it's been published in English, too), and
the example programs in it made rather liberal use of global variables,
GOTOs (and even of arrays of labels), and the program layout was rather
cluttered and not very much like the way you're taught a program should
look nowadays.



By the way, several of the postings mention the difficulty of
implementing a fully recursive language on 'primitive' machines (I know
from the compiler construction course I took that it's quite a lot of work,
even on a VAX). Apparently, most early Algol compilers did *not* implement
recursion. Does anybody have any comments on this? Wasn't this considered
to be a rather glaring omission at the time, or didn't people write
recursive programs back then?


Magnus Olsson		     	| \e+ 	   /_	      
Dept. of Theoretical Physics 	|  \  Z	  / q	      
University of Lund, Sweden	|   >----<	      
Internet: magnus@thep.lu.se	|  /	  \===== g    
Bitnet: THEPMO@SELDC52 		| /e-	   \q	      
Technical Details
Message-ID: <9007300920.AA20411@thep.lu.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!sdd.hp.com!decwrl!ucbvax!THEP.LU.SE!magnus

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!sdd.hp.com!decwrl!ucbvax!THEP.LU.SE!magnus
From: magnus@THEP.LU.SE (Magnus Olsson)
Newsgroups: comp.lang.misc
Subject: SP as "no goto's and nice indentation"
Message-ID: <9007300920.AA20411@thep.lu.se>
Date: 30 Jul 90 09:25:53 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Lines: 56