Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public variables
Message
 
To
13/06/2002 13:20:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00667392
Message ID:
00668112
Views:
27
Fernando,

The reason for not using PUBLIC vars is simple. The domain for a PUBLIC variable (what makes it different from a PRIVATE) is that it lives beyind the end of the routi9ne that creates it. Thius means that if you NEED a public var it is because something at a higher level in the calling stack is dependant on what occurs in the routine that "needs" a public. This si a violation of the basic programming principle of encapsulation, that is any routing should have everything it needs within it self or receive those things as parameters.

Plain and simple, PUBLIC variables violate an essential principle in "good" programming practices. BTW, Encapsulation is not just OOP it is structured programming as well. Encapsulation says that no routine should ever depend on another routine for its own proper functioning (except for arguments passed to it).

JimB
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform