Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How much of your code do you test?
Message
 
To
12/11/2002 12:32:59
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00721300
Message ID:
00722069
Views:
26
>> Every module is indepently tested and proven to work as designed. Most
>> of the problems I run into are related to bad data.
>
>you mean, as in, the module did not defend against (check for) bad data ?
>is data validation specified as part of your module specifications ?
>or do you just rely on field validation at input time ?

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.
George

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

Click here to load this message in the networking platform