Go To Statement Considered Harmful



Just a little food for thought in the "goto" debate. I don't know how many of
you have actually done any formal study on such things, but below is a link
to a website where you can read Dijkstra's original letter "Go To Statement
Considered Harmful", with annotations (not all of which I agree with) and
other related material. You might find it interesting, though many of you seem
to be deeply entrenched from an emotional standpoint, rather than from an
intellectually defensible one. :-) Just remember why "goto" was targeted in
the first place: extensive statistics showed there was a very high *inverse*
correlation between the number of "goto" statements used and code quality.
Statistics showed that individual programmer productivity varied by as much
as *25 times*, and that it was the same programmers who produced the most
code and best code, and that they used few or no "goto's". But the worst
programmers produced much less code, much poorer code, and it tended
to be littered with "goto's". That wasn't pulled out of a hat by academics;
it was a very clear pattern shown by extensive statistical studies of real world
production programming projects. It was after those studies that "goto" was
given serious academic study, mostly to understand "why". The "what" was
already obvious. :-)

http://david.tribble.com/text/goto.html
--
Judson McClendon judmc@xxxxxxxxxxxxx (remove zero)
Sun Valley Systems http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."


.



Relevant Pages

  • Re: Go To Statement Considered Harmful
    ... Statistics showed that individual programmer productivity varied by as much ... and that it was the same programmers who produced the most ... debugging required, using easy to read and follow logical code, that is easy ... avoid use of "goto". ...
    (comp.lang.basic.misc)
  • Re: Larkin, Power BASIC cannot be THAT good:
    ... much he had been abusing goto. ... that had subroutines with parameters. ... is no check on programmers being responsible, ... egotistical douchebags who don't want to accept responsibility when ...
    (sci.electronics.design)
  • Re: Coming back to Basic after many years
    ... is also supported in C for the exclusive benefit of bad programmers. ... such judgements, which is why we have coding standards and guidelines. ... indicated previously, the use of goto is very rarely justified, even for ... it's still an explicit transfer of flow control ...
    (comp.sys.acorn.programmer)
  • [patch 6/6] statistics infrastructure - exploitation: zfcp
    ... This patch instruments the zfcp driver and makes it feed statistics data ... goto failed_req_create;} ... * GNU General Public License for more details. ...
    (Linux-Kernel)
  • Re: Why doesnt JavaScript have a goto command?
    ... Yet several of my JavaScript programs are practical and solve very ... I want a goto statement, because it would make my programming life ... programmers have been alive. ... And I suppose Perl is not a Modern Language? ...
    (comp.lang.javascript)