Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single exit-point
Message
 
À
03/04/2002 09:31:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00640316
Message ID:
00640324
Vues:
16
Hilmar,

>I read somewhere that a function (or method) should have a single point of exit (RETURN). Is this considered a general design principle, that should usually be followed?

>I find that it is more complicated to code a function or method to have a single RETURN, but I also see that it may make cleanup (if required) easier.

IMO having one exit point is mure structured and easier to maintain. Especially for cleaning up (as you mentioned). In many cases I have to set something back, release an object or have to do anything else, before returning and I want to do this only in one place. If you first think, you won't need to clean up and you are enhancing your code later and then you have to, you will have to change a lot of your previous code.

Armin

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform