Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Always stops evaluating if..?
Message
De
21/08/2005 15:57:21
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
21/08/2005 14:38:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01041159
Message ID:
01042580
Vues:
26
>I don't think an IF...ENDIF, unless it goes beyond a certain number of nesting levels, is ever too complex. In fact, I feel quite strongly the opposite. I even prefer IF...ENDIF to IIF(...).
>
>I know there is a school that truly believes that any "extra" line(s) is the equivalent of added complexity. I just think they are wrong.
>Probably it comes down to the idea that I don't write my code for VFP "experts" but rather for average-->lower-skilled VFP developers. The idea being that virtually anyone can then maintain my code.
>I acknowledge that VFP "experts" might criticize such code, but I see that as their problem, not mine.
>
>cheers

Well, the message you reply to was merely to point out that speed optimization is not the only reason for shortcut boolean evaluation - another reason was to avoid errors.

If you prefer nested IFs, that is no problem with me...

By the way, yet another reason for shortcut boolean evaluation might be to avoid side-effects of code:
if functionA() and functionB()
  ...
endif
If functionB() changes anything in the environment, then it may very well make a difference if SBE is used, or not.

Once again, the code is completely equivalent to nested IFs; but a seasoned programmer should know that SBE does exist: in the code above, there is no guarantee that functionB() will be invoked!
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform