LOL, and those who don't use GOTO's are lesbians!!Joakim Christiansen wrote:All people using GOTO's are gays!!
Is use of GOSUB bad coding?
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
A typical nonsense discussion, this matter seems often based on being scared what others think.dioxin wrote:GOSUB/GOTO are powerful features but not everyone is up to handling them.
Those that can, get on with it.
Those that can't tell everyone else they're wrong.
Paul.
Is using an open file statement not equally 'bad'?
I mean i can overwrite a windows dll in a snap.
At least gosub's where very handy to me, goto's a little less but sometimes..
It's a pitty .net abandoned these at all.
Oh well, that's another topic
You know what REALLY bad programming is?
1) Things like DEFINT and so.
2) A programming language not being able to set an OPTION EXPLICIT (or lookalike).
I believe pb has this feature at last in this v4.0 release, if so, apreciated.
3) Well, you might think of this one.. not forcing a winmain procedure, well.. can't explain why but somehow i find this having to much of a Quick Basic taste..
well, i've never ever found a reason to use goto or gosub...
i tend to believe goto's are not the best choice in most cases, but i don't like the 'break' command either
in fact, anything that breaks the 'flow' of the code is what i do not like
ie. i want code to be 'closed', as in
there's no jumping in or out, and it's quickly possible to see what belongs to what
well, perhaps someone can show me a case where goto is improving your code? (ah, a challenge!
) if no one can i think i'll switch to the 'goto is bad' camp 
i tend to believe goto's are not the best choice in most cases, but i don't like the 'break' command either
in fact, anything that breaks the 'flow' of the code is what i do not like
ie. i want code to be 'closed', as in
Code: Select all
for a = 1 to 10
b = b+1
next a
well, perhaps someone can show me a case where goto is improving your code? (ah, a challenge!
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
>where goto is improving your code?
I think no-one but it's simply a benefit, espec. a gosub.
I'm doing .NET, you know what i think is bad programming style?
Being possible to reuse a dimming statement in a loop like:
Foreach(...)
{
(objecttype...) x = new (objecttype...);
}
It works but i found it counter productive (speed reasons and such)
Note that this won't compile:
(objecttype...) x = new (objecttype...);
(objecttype...) x = new (objecttype...);
So why should it work in a loop?
I do understand but it's not logical to me.
I think no-one but it's simply a benefit, espec. a gosub.
I'm doing .NET, you know what i think is bad programming style?
Being possible to reuse a dimming statement in a loop like:
Foreach(...)
{
(objecttype...) x = new (objecttype...);
}
It works but i found it counter productive (speed reasons and such)
Note that this won't compile:
(objecttype...) x = new (objecttype...);
(objecttype...) x = new (objecttype...);
So why should it work in a loop?
I do understand but it's not logical to me.
IMO, bad code is code that is hard to support.
If it does the job adequately: If the next guy can understand it and enhance it: If you can maintain it 1 year down the track: Then it is good code.
That is all that really matters.
Edit and aside: C++ is bad code waiting to happen.
If it does the job adequately: If the next guy can understand it and enhance it: If you can maintain it 1 year down the track: Then it is good code.
That is all that really matters.
Edit and aside: C++ is bad code waiting to happen.
@}--`--,-- A rose by any other name ..
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
Hmm, no programmer will be able to understand code from someone else if it's size is becomming to large, even if it is rock solid code.Dare2 wrote:IMO, bad code is code that is hard to support.
If it does the job adequately: If the next guy can understand it and enhance it: If you can maintain it 1 year down the track: Then it is good code.
That is all that really matters.
Edit and aside: C++ is bad code waiting to happen.
I mean all the jumps to different functions make it very difficult to understand the code.
Often a rewrite is a valid option, we encounter these matters so now and then.
Sometimes the decision is made to wait with updating to plan a major rewrite.
Yes.. all bad practises, documentation is poor and if someone leaves the building... well you can fill that one in yourself.
Frankly, i don't even think that documentation would help.
But then, i never document, i keep functionality as modular as possible.
Each functionality in a separate includefile.
Each function described briefly.
It is maintanable but does not help other programmers, at least myself.




