Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One exit per procedure/function/codeblock to what purpos
Message
De
09/10/2003 16:46:03
 
 
À
09/10/2003 15:16:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00835552
Message ID:
00837104
Vues:
45
SNIP
>
>>Just as an aside... my PERSONAL choice is to never code a CASE series like that. I agree that it's perfectly legal and quite sexy too, but just not the knid of thing I leave 'for the next guy'.
>>
>
>Why not? The reason I do it this way is that I WAS the next guy, and grateful for it <s>

A genuine (additional) case of PERSONAL standards, I suppose...
I believe that a CASE should NOT do THE "work" but should simply interrogate the nedd to have the work done. It is my PERSONAL opinion that the case < double entendre > here is misused, the desire to save code lines outweighing clarity. Certainly it is my normal expectation, when I see a CASE, that ONLY ONE will execute. Putting the "real" work in the CASE statement itself is to me a trick that is unhelpful.
While my CASEs often have function calls in them, the only 'work' those functions do is to contribute to the answer of the CASE's 'question'.
To me an indented multiple IF would be clear and do the job better, especially for the next guy.

I guess it comes down to this when "the next guy" is concerned... it could just as easily be a rookie as a foxpert and my aim is to write clear efficient code that a rookie can handle right away without surprises or hair-pulling.

>
>>All in all I'm STILL of the opinion that there need be NO GLOBAL "STANDARD" **either way** (which of course would mean outlawing multiple exits in practise, 'cause no one is going to mandate them) and that it is perfectly sensible to leave this and several other posible 'standards' to the discretion of individual programmers.
>>
>
>I agree. Except with the "to the discretion of individual programmers" part IF you are in a team environment. In that case, the individual programmers should follow the house rules.

Right, team rules rule, but what I am trying to get at is that this should NOT be a "team" coding standard in the first place so that programmer's discretion/flexibility can be exercised.

cheers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform