Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How much of your code do you test?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00721300
Message ID:
00722120
Views:
23
>>Had a thought on this that I want to share. Beginning with VFP 6.0, validating data for objects became a whole lot easier with the _Access and _Assign events. Combined with the bitwise functions, it makes checking for a large number of properties a snap. The following is from my own work.
>>
>>I had a situation where a large number of properties (over 20) had to be properly initialized prior to making some very complex calculations. By adding an _Assign method to each property, I was easily able to validate the incoming information. If the information was valid, I set a bit of an integer property to indicate that the data was valid. If it was invalid, I made sure that the bit was cleared. Each property was thus represented by a bit. Using BITAND() allowed me to easily test to make sure that all the necessary properties were properly initialized.
>
>
>Good idea, George. It might be even easier to implement this idea in VFP 8 using BINDEVENT()function. Instead of creating separate _Assign methods one can bind the necessary properties to one custom check method, that fire whenever any bound property is changed and will validate all the properties.

I hadn't even thought of that Nick. Thanks.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform