So this is why GOTO is considered harmful!

I knew using GOTO was bad, but I never realized how bad was it. Since I mainly use Java, PHP, Perl and C# I was never even tempted by it. And I’m glad. I mean Dijkstra, never said anything about Raptors:

goto_1.Pnggoto_2.Png
comic © xkcd. layout edited to fit format. [click to see the original]

Sigh… If this guy only remembered to always carry his grape juice with him, he might have lived to tell us this story himself.

[tags]xkcd, comics, raptor, goto, dijkstra, goto considered harmful[/tags]

This entry was posted in Uncategorized. Bookmark the permalink.



3 Responses to So this is why GOTO is considered harmful!

  1. Starhawk UNITED STATES Mozilla Ubuntu Linux says:

    Damn Raptors, you’d think somebody would get away with using on little simple goto.

    I guess ya never had the pleasure or frustration of trying to debug a carefully crafted buggy ass piece of spaghetti code then. Or even worse trying to figure out how ya going to add some new feature or function to such a monstrosity. haha

    I’m a little older than you well alot maybe but anyway i had a professor in college let’s call him Ray (i’ll save him the embarrassment of revealing his last name) who was totally and completely opposed to the whole structured programming movement. he used to rant and rave about it in class writing code full of clever and completely tangled ass logic. He should’ve been a Pastafarian as much as he liked spaghetti but he was alas a catholic which i thought was very odd then. I liked Ray he had these wild parities once a year at his house and invited everyone in his classes and more. I wasn’t much into the Alcohol gods but the prospects of drunk girls now that another story :D. But needless to say me and my friends would crash his party and we were between animal house and Hunter S Thompson yep that was great fun he’d be drunk and everything would be completely outta his control.

    Well anyway that’s essentially the flaw with using gotos. One might not hurt and may even have a place now and then (even Stroustrup agrees) But like crack or lays potatoes chips one is seldom enough and before ya know it your life’s a mess and your code is completely outta your control.

    One of my first computers was a TS 2068, a great little machine for hobbyist based around a Zilog Z80A microprocessor. It would actually outperform an Apple II or a trash 80 popular at the same time. The operating system was basically a dialect of BASIC but it completely lacked If Then else while and do statements as well as any kind of case statements or On gosub. One had to do all that with gotos or gosub or else a bunch of If statements. Of course in the tradition of the time and due to the limitations of those machines one was forced to use machine code in critical places so it was easy for a complex program to turn into a complete mess. lmao.

    Since a logical expression evaluated as a number either 0 or 1 and could be used in an algebraic expression I took to crafting complex logical expressions and storing them in a string and simulating an On gosub with a GOSUB val$(A$), i also took to storing machine code in strings which was complicated by the fact string locations moved around in memory. And then to compound my own absurdity I would have my code alter what was stored in these strings as the need arose. hmmm worked great sometimes haha I wrote a 4 -d rubics cube program that way menu driven using a joystick in a mouse like way. But alas I tried to write a word processor and kept adding features to it. I was an electrical hobbyist then and had hooked my Sinclair up to a circuit i designed and then up to an dot matrix printer and my word processor turned into a complete mess after a year or two of me adding more and more features to it. I eventually scraped it and rewrote it from top to bottom paying close attention to like structure programming philosophies and data abstraction ( data hiding ) ideas. Then i started programming an ms dos machine and that was the end of my Sinclair days (apple ii days too).

    oh well a blast from my past. haha. Somehow tho I avoided the wrath of the raptors I always liked grape juice tho. haha

    BTW I had to learn ALGOL 60 in college, ya mentioning Dijkstra reminded me of that one…I didn’t like it much.

    Reply  |  Quote
  2. Luke UNITED STATES Mozilla Firefox Windows says:

    Actually I did some BASIC and C++ at HS level so I was exposed to the evils of Goto in a way.

    My university was teaching Java though, and I kinda got sold on that language. :)

    Reply  |  Quote
  3. Starhawk UNITED STATES Mozilla Ubuntu Linux says:

    Basic was good for its time esp for hobbyist using the 8 bit machines back in the day. Some form of basic was on all those machines, I was tho glad to see case statements and on gosub added to most of the basic dialects in time. but basic like pascal which was more sensible in many ways while still having an influence on some langs today have become mostly a memory. haha.

    Besides The rise of OO was a good thing. and java has alot going for it. Your lucky in a way to have learned programming when ya did, my generation of programmers has had to learn and relearn. Changing old habits and learning new ways of thinking is not exactly easy. I know two fortran programmers, well one of them is now dead but anyway they were simply not able to do it. The one that is alive runs a business now using qbasic msdos and dbaseIII. Is confused by windows, but what he does works for him so what can i say.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *