[Gambas-user] usage of too much GOTO can be bad pracitce or make influence in the code?

Fernando Cabral fernandojosecabral at ...626...
Sun Jun 25 17:10:13 CEST 2017


2017-06-25 6:31 GMT-03:00 Christof Thalhofer <chrisml at ...3340...>:

>
> > I never understood the religious cruzification of Goto.
>
> No doubt you can use a GOTO in a effective and understandable way.
Especially if you are just jumping a few lines downwards as you mentioned.
But my 40-year long experience with  more than a dozen programming
languages has always shown me this simple truth (for me!):  if I come to a
point where a GOTO is the best solution I can think of, then I'd better
rewrite the code because something has gone stray. To begin with, probabily
I don't know what I am doing. I have not thought enough about the problem
at hand.

Yes, even C has a GOTO. But if I remember correctly the original C Manual,
it briefly mentions it and then recommends against using it.

Now, this is not a religious crucification of GOTO. This is the result of
the 60+ collective experience with GOTOs. I have never met a good
programmer that relies on GOTOs to jump out of spaghetti-like code. That's
because good programmers to not have spaghetti code, to begin with.

But, again, I agree that jumping a few lines down the lane might not
obfuscate the code to the point of making it unreadable. But then again,
"breaks" and "loops" might work better even when you have nested loops.

My two cents.

Regards

- fernando


> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>


-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecabral at ...626...
Facebook: f at ...3654...
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.



More information about the User mailing list