Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single exit-point
Message
 
To
03/04/2002 09:31:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640316
Message ID:
00640324
Views:
15
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
Previous
Reply
Map
View

Click here to load this message in the networking platform