Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Argument starter - The roots of all evil
Message
From
02/09/2004 11:33:26
Walter Meester
HoogkarspelNetherlands
 
 
To
02/09/2004 10:52:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00938079
Message ID:
00938789
Views:
21
Jim,

>>In the case of LOOP and EXIT it is not that simple, in the sense they (probably) have a history in which they were regarded as good/common practise. As you know it is terribly difficult to restore mistakes from the past so we cannot remove those commands from the language, (Though I personally would like to see those command removed and introduce better iteration commands like REPEAT UNTIL) but of course we can't because of backward compatibility.

>I have to take issue with this statement (feel free to EXIT reading now < s >).
>You say "were regarded as good/common practise", implying directly that they are now BAD practise.

I don't mean to tell they are bad practise, however that their general practise is in question.
I think a book like CODE complete handles this issue also but does not take a hard standpoint on this. It warns about the potential danger and missuse.

>That may be true IN YOUR OPINION, but it is not true in the (programming) world at large.

I'm aware LOOP and EXIT are used on large scale in the programming world. And though there are definately a huge number of examples where LOOP and EXIT are not leading into difficulties and are defendable, it is a given fact that those two constructs created the possibility to create awfull, unreadable and erronous code. And I bet everyone who had to read through massive amounts of code from third parties has encountered those situations on large scale.

What I'm trying to imagine is how structure programming would have been evolved without those commands. There is no absolute need for those commands as any algorithm can be written without it (at least with the available commands in VFP).

>You say "so we cannot remove those commands from the language". Again, it is your opinion that these would be better removed from the language. Mine is that they are indespensible for GOOD programming. But the fact of the matter is they can be "removed" in the sense that shop standards can prohibit ANY command. This is how, in fact, the COBOL GO TO statement was treated for those persons, including myself, who were programming when they were commonly used.

>You can come up with any new command construct you want (REPEAT UNTIL, for instance) but there will always be a situation somewhere that needs to stop some specific processing in a given instance.

As I said above, you can achieve the same without them. There is not any algoritm that cannot be created without them. Whether it is always the most efficient solution might be another question, but perhaps those gaps can be closed by other language improvements (like the REPEAT UNTIL).

>In any case I think most contributors here agree that there is little room for a hard-and-fast rule on this issue (as opposed to COBOL use of GO TO being definitively outlawed) and that there can be good uses for these constructs.

Sure, we have these EXIT/LOOP commands, and they are used properly by many developers, and having identified the usage mainly a personal preferences there is no point in taking this stance. Though I rather see them removed from the language to avoid missusage from the kid on the block writing a piece of code (after which you are called to solve the problems), it is unrealistic to expect to take off a candy that so many developers use daily with little to no trouble.

>The MAIN reason I participate in such debates is to preclude the conclusion that "thou shalt never EXIT/LOOP".

I understand, and I agree. However like the usage of macro's I would say:
"You should know when to use LOOP/EXIT and when to avoid". This rule obviously was broken by the subject of the creator of this thread.

>I am a person who has "maintained" lots and lots of other people's code. I've seen countless different styles. In my early days of this kind of work I used to bemoan that people programmed poorly (from my point of view, naturally). I eventually came to learn that the attitude only slowed my work and contributed to less satisfaction.

Point taken.

Walter,
Previous
Reply
Map
View

Click here to load this message in the networking platform