Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passed Parameters vs PUBLIC memory variables.
Message
From
05/10/1997 19:26:08
 
 
To
05/10/1997 15:36:25
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00053333
Message ID:
00053358
Views:
21
Pros for parameters against PUBLIC vars:
1. You hide the programming details in each function/procedure. Similar to encapsulation in OOP. This way you can use func/procs without knowing what's inside and it's enough to know their interface (input & output).
2. Funcs/procs/modules are more independent. This also like encapsularion in OOP. Same advantages, plus: you can reuse code easier since it doesn't depend so much on the environment.
3. Having 1 and 2, it's much easier to maintain code, to change it and to optimize it. When new programmers have to learn the system, it's also much easier.
4. The code is easier to test, so less bugs.
5. The code is clearer, so easier to control, understand and find logic mistakes.
6. It's easier to convert to OOP.

There are also other advantages. That doesn't mean you shouldn't use PUBLIC vars when needed. No rule is absolute! :)

Vlad

>Here's a stupid question... What are the pros and cons of passing parameters to
>procedures and functions as opposed to making the memory variables PUBLIC and
>using them in procedures and functions without passing them as parameters?
>
>Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform