-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTRAIN_00505.eml
41 lines (31 loc) · 1.84 KB
/
TRAIN_00505.eml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
NoneNone> Example the GOTO, most languages support a goto of some sort, so are gotos really bad?
Oh goodie. My final year project rears its head :-)
> Is a loop or a recursive call actually any better than a goto
> or is the goto used as a kind of common enemy of
> programming syntax
Much as I would like to answer an unqualified "yes", I must admit: if
you already code in a style that makes heavy use of GOTOs, coding in the
same style with GOSUBs or function calls does not improve code. Much the
same as when the manuals on "modular coding" said to write modules that
would fit on a single sheet of computer paper, lots of coders proceeded
to split their code into arbitrary 60-line chunks. :)
However, "Go-to considered harmful" points out that to analyse (==debug)
code, you need to be able to tell what the point of execution is, and
what the values of the variables are at that point. This is an easy(tm)
job if the code uses assignment, if(), for() and functions, but not if
it uses GOTO. (See http://www.cs.utexas.edu/users/EWD/ewd02xx/EWD215.PDF
for the full letter).
Despite being one of Dijkstra's brain-damaged children who learned BASIC
at an early age :) I never use GOTO anymore (or any of its bastard
offspring like break, continue, fudged function calls with sleight of
hand in the variables). My code is longer than it might be if I had used
GOTO at a critical, handy point. However, code is a bit like networks -
you always end up adding bits on where you didn't expect to - and the
benefit is felt when another person (like myself but in three months
time) is modifying or debugging it and doesn't have to go through the
hassle of dealing with the impact of the GOTO.
Dave
--
Irish Linux Users' Group: [email protected]
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: [email protected]