PDA

View Full Version : Funny



Imperito
08-21-2002, 11:58 AM
From my Intro to C programming class (which is funny in general, imagine a lecture hall full of 150 people, 100 of whom are already competent C programmers who are stuck there because it is unavoidable...)

The teacher put the course notes on her website, and included in the style guide is this little gem...




11.
Do not use the goto statement.

The goto statement is evil! If you need to use it, it is a definite sign of bad code. Those who use the goto statement will be punished.


Not just bad, but evil... Not just penalized, but punished...

Not that I disagree with the statement, but I found the wording interesting.

Of course its about as funny as the third slide of the powerpoint presentation she gave the class, which was a picture of a computer with lines pointing to the monitor, keyboard, joystick, speakers, and so on.

MrWizard
08-21-2002, 03:30 PM
Man thats pretty good stuff. How was the class unavoidable? At most colleges you can challenge any class. The teacher will give you the final and if you pass it you get a P for the class I believe. No gpa points are awarded but you receive the full 3 credits or however many the class is. I did this for a 'intro to computers' class.

Prelude
08-21-2002, 03:47 PM
Prelude's Translations:

>The goto statement is evil!
Translation:
I'm an idiot.

>If you need to use it, it is a definite sign of bad code.
Translation:
I've only written trivial programs and never needed goto, so anyone who uses it is a bad programmer.

>Those who use the goto statement will be punished.
I'm trying to make everyone believe my flawed logic through intimidation.

This is a good one, would it be possible for you to post a link to this website? I like a good laugh every now and again. :)

-Prelude

MrWizard
08-21-2002, 03:49 PM
Originally posted by Prelude
Prelude's Translations:

>The goto statement is evil!
Translation:
I'm an idiot.

>If you need to use it, it is a definite sign of bad code.
Translation:
I've only written trivial programs and never needed goto, so anyone who uses it is a bad programmer.

>Those who use the goto statement will be punished.
I'm trying to make everyone believe my flawed logic through intimidation.

This is a good one, would it be possible for you to post a link to this website? I like a good laugh every now and again. :)

-Prelude

I was thinking the same thing. I cannot fathom the other things that she has put on there. I can't wait to see! :D

mithrandir
08-21-2002, 04:29 PM
Even Knuth (somwhere I know) talks about the advantages of goto...correct me if I'm wrong prelude :)

ygfperson
08-21-2002, 04:47 PM
i know this is the 267'th time this has been asked...
but what advantages are there to using goto? can't everything be done with an equivalent non-goto command that looks and fits better?

golfinguy4
08-21-2002, 05:13 PM
Say you are in a series of 4 or 5 nested loops and you want to break out of all of them. Which is more effecient, having a flag and breaking out of each loop individually or using a goto to right after the loop?

Imperito
08-21-2002, 05:22 PM
I agree with both parties here.

Yes, Prelude and the other board members have a point about goto and the JMP opcode having usefulness in really time-critical applications, where exiting a control stucture gracefully is not an option, but I see where it would be a good idea for Dr. Nihan to impress on introductory students that goto is not the magic wand it first appears to be.

Also, for anyone interested, Clicky! (http://www.cs.ucf.edu/courses/cop3223/nihan/)

The "Programming Style Guide" is where that quote was pulled.

The notes from the first lecture are also visible, you can hear my response to that here. (http://ars.userfriendly.org/users/read.cgi?id=26923&tid=53599)

Prelude
08-21-2002, 05:35 PM
I agree (more or less) with everything on that page except for the comment about goto. I feel it shoudn't be used except when absolutely necessary, but a thoughtless ban on its use is stupid.

-Prelude

Imperito
08-21-2002, 05:41 PM
I thought 11 was worded oddly, but the only one I thought was off-base was 3, where she said that putting a command after an if was not as clear as under. I find that when an if binds only to one command to which it is logically connected, it is better to put it right after.