23
Nawap
6y

Why is GOTO deprecated and not recommend!?
It was fun in school days programming, I used to write code randomly then use GOTO to sequence it.

Did anyone had fun with GOTO!?

Comments
  • 20
    It’s deprecated and not recommended for exactly the reason you described. Trying to read, understand and debug code that has been written randomly and jumps all over the place is a nightmare
  • 5
    Goto was necessary and in assembly the only option but it makes it harder to read in large projects
  • 3
    @Nawap Do you know the game TIS-100? There it 's perfectly fine (and fun) to use GOTO.
  • 11
    Imagine a book wrote randomly and each paragraph is pointing to another... is it more readable than a classical book ?
    Do not forget that : 'code' is a language to simplify communication between humans, HUMANS, not machines. The main 'job' of a developper is 'code for humans, code for readability' not code for machines. Remember, machines are just binary code.
    What do you think about that ?
  • 4
    @IllSlapU @practiseSafeHex
    I know the disadvantage of it.
    But it should be kept for fun.
    See Java does not have GOTO.
    Python I Do not think so.

    My point was just keep it in all languages,so ppl can have the fun of crappy coding
  • 9
    @Nawap If you want to have fun with GOTO you can always download some MIPS assembly simulator and go nuts.

    Putting it into modern languages just for fun only gives the wrong people the wrong ideas.
  • 1
    @zazapeta
    As I have clearly mentioned ,
    It's like for fun.
    Iam not promoting to write code with GOTO.

    See,
    it would be fun reading one the book which exactly like u described , in a break .
    Its frustrating if u have all books like that
  • 10
    goto is perfectly valid construction and makes sense if used wisely - see how kernel uses it. There are people claiming that it is bad practice to use goto and that it is drprecated. Those are either aware that most people are stupid and will hang themselves with it (same goes for malloc, casts, free) and would use it in many stupid ways so they nan it altogether, or they are full of bullshit as they heard it from the first group, never thought about it and spread it around.
  • 1
    @Nawap @irene So, GOTO are like 'Quest code' x) . For the sake of fun, why not :D . The game is not what the code does, but the code itself.
    I guess it can be incredibly instructive and funny
  • 0
    Cause it's shite
  • 2
    Well the textbook answer would be its deprecated because of Edgar Dijkstra’s paper “goto considered harmful”.
    Goto allows unrestricted direct transfer of control, which isnt so bad if the scope of it is tiny. But as soon as the scope exceeds a few lines you are introducing potentially serious side effects. Edgar goes into a lot more detail of course. If you want a good summary, read Clean Architecture by Bob Martin
  • 4
    1. GOTO sucks in big code. Never use GOTO more than two times in a row. plz
    2. GOTO is needed when you want to hop off a loop immediately. Only use when you need that kind of feature in your code.
    3. Using GOTO goodly, goodly, goodly will make your code easier.
  • 6
    @deadlyRants I love MIPS assembly! We've implemented a 32bit MIPS processor on a FPGA, for a class at university. We then wrote assembly and tested it with a debugger and later flashed it to the board.

    It was mostly simple stuff, like a snake moving arround on the FPGA display and such things, but it was the most fun I had studing!
  • 0
    @zazapeta that sounds just like the old solo adventure books :)
  • 1
    @Nawap C# has goto and i know t is used within the yield interator implementation.

    And I have used it sometimes in Linqpad scripts where I just needed some quick and dirty one of code that I just could not bother to refactor when I found myself in a dead end.

    But never in production code, not even the switch fall through option (c# does not have implicit fall through, you have to explicitly goto another case)
Add Comment