Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 12 February 2012 - 05:48 PM

At my workplace, I was tasked with updating the letter templates. They are written in a custom markup we use, which is similar to VB, so I thought it wouldn't be too difficult. This is the skeleton of template I was given to "update" (all IP references removed). Suffice to say, I trashed it and rewrote it from scratch. While this code might not look too bad, this is just the skeleton of it. The entire code for this one template was 546 lines.

Re: Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 15 February 2012 - 08:12 PM

I wouldn't say goto statements are useless and I also wouldn't say bubble sort is bad. There are certainly times when bubble sort is the right way to go-- given a small enough data set it can out perform even the best algorithms.

However, in this case the goto statements seem excessive and nasty. Down with it!

Re: Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 16 February 2012 - 07:39 AM

Good that my teacher made me never use goto again. From my first year he saw a goto in my program, even if it was the best program in class, at the beginning he was most disatisfied with my program... He told me that if he will ever see again a "goto" word in my program he will mark me with the lowest mark there is, doesn't matter how good the program will be. Than I've read more on goto and found that it leaves garbage in programs and some other shi**y things and whenever I see people saying that goto is not bad I just get mad. I really got mad seeing "goto", it's an instant reaction, even if I don't care about the code I just saw

Re: Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 16 February 2012 - 11:15 AM

See, I have the same experience. They never took our ability to use it away, but it was frowned upon. Once I had to deal with code of people who did use goto a lot, I understood why. That said, I've been doing a lot more Assembly, and a "goto" is really all you've got there.

Re: Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 16 February 2012 - 12:31 PM

Zachari, on 16 February 2012 - 11:15 AM, said:

See, I have the same experience. They never took our ability to use it away, but it was frowned upon. Once I had to deal with code of people who did use goto a lot, I understood why. That said, I've been doing a lot more Assembly, and a "goto" is really all you've got there.

I did half year of assembly and anyway I never use goto in C/C++, that's not an excuse

Re: Goto hell. Do not parse code. Do not collect $200 paycheck.

Posted 16 February 2012 - 08:50 PM

And he expected you to avoid them as well? That's going a bit overboard.

I mean sure, it's probably best to try and set your logic up so you don't need them (that's almost always possible), but it's not as big of a deal. All "break" and "continue" do is end a loop/block and skip the current iteration of a loop, which isn't exactly hard to follow. They don't share goto's ability to create the kind of horrendous code e_i_pi showed us.