[net.lang] Discouraging "GOTO"s in introductory computer courses

laman@sdcsvax.UUCP (05/23/84)

GOTO next line

I strongly agree about discouraging the use of GOTOs in an introductory
computer course.  I taught GOTOs on (LITERALLY !) the last day of class.
I reminded them that we NEVER used them in class and of all the different
programs and algorithms we wrote with out them.  The also believe that there
are situations where using GOTOs can make code clearer than by not using them
(breaking out of certain multi-loops, error conditions where error recovery
 is desired).

I am FIRMLY convinced that the delaying of GOTOs help my students to be
better programmers in that they will be more likely to carefully think out
the problem, and thus end up with a program that solves the problem in a more
coherent manner (because of a better understanding of the ENTIRE situation).

			Mike Laman
			UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman

darrelj@sdcrdcf.UUCP (05/24/84)

10 years ago, I had the job of installing a PASCAL compiler for some
instructor's class.  The one funny request was when reproducing Wirth's
documentation, I was to snow-paque out the GOTO entry in the syntax diagram.
-- 
Darrel J. Van Buer, PhD
System Development Corp.
2500 Colorado Ave
Santa Monica, CA 90406
(213)820-4111 x5449
...{allegra,burdvax,cbosgd,hplabs,ihnp4,sdccsu3,trw-unix}!sdcrdcf!darrelj
VANBUER@USC-ECL.ARPA

rcd@opus.UUCP (05/25/84)

How well you can avoid taching about GOTOs depends a lot on what language
you're teaching.  I've taught intro with Pascal, and I was able to defer it
for about 2/3 of the course, but only with careful choice of examples and
problems.  Pascal is weak in two areas:  It lacks any sort of loop exit,
and it doesn't have McCarthy (short-circuit) conditionals.  Lack of
procedure exit is also a problem that begets GOTOs, but that's not as
serious in an intro course.

Two points which you need to understand about teaching intro, as compared
to doing real programming:
	- you've got to deal with (and hopefully try to repair) brain
	  damage caused by exposure to BASIC.  An increasing number of
	  incoming college students are learning to code without learning
	  anything much about programming.
	- when teaching, you can afford to (and often must) take a position
	  more dogmatic than you really believe.  The idea is that if you
	  take a position two standard deviations out, you may get your
	  students out one S.D. in the right direction.

Would it have been better to teach C (assuming other circumstances had been
equally favorable to C and Pascal)?  I think not.  C is ok for an
experienced programmer; it's fine for an assembly-language hacker (taken in
the non-pejorative sense) who's in a hurry; it lacks the constraints I
think are needed to guide a novice.
-- 
...Stop to smell the flowers.				Dick Dunn
{hao,ucbvax,allegra}!nbires!rcd				(303) 444-5710 x3086

crane@fortune.UUCP (John Crane) (05/25/84)

I have taught COBOL, RPG, BASIC, and FORTRAN for about 4 years all
told. Really groovey and "with it" languages I know. I introduced
structured COBOL at several placed where I worked. There's no way
you can avoid GOTOs in COBOL, try as you might. However, I have
been programming in C now for over a year and have NEVER had to
use a GOTO. Even with old coding habits, I have never found the
need to use one. I would strongly discourage their use by students
just as COBOL instructors strongly discourage using ALTER.

broome@brl-tgr.ARPA (Paul Broome ) (05/26/84)

Some of the tradeoffs between clarity and efficiency in programming 
were treated by Knuth in a Computing Surveys article, "Structured
Programming with GOTOs."  It appeared about 15 years ago.

In it Knuth called for program transformation as a way of going from
the clear but probably inefficient program to one that is efficient 
but probably hard to understand.

I think it's a great paper.  There are several nice transformations
of recursive programs into iterative programs that introduce GOTOs.

					Paul Broome
					brl-tgr

laj@wnuxb.UUCP (JOHNSON) (05/29/84)

>There's no way you can avoid GOTOs in COBOL, try as you might.

I'm not sure I believe this.  I would like to be convinced that
this is so.  Whether one should or should not use GOTOs in COBOL
is, of course, an entirely different matter.

					Larry Johnson
					ihnp4!wnuxb!laj