Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate A Class
Message
 
To
05/04/2010 17:03:35
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01458686
Message ID:
01458856
Views:
47
Back in my VFP days when I was writing COM DLL's I would have an internal Validate method that would perform validation on required items, and if something was not right, I would set an ErrorLevel property to a unique error number. Then the calling class/form
would check the property to see if was > 0. Problem is that this couples the DLL to the class.

So, what I'd really like is some way of my class notifying the calling class that the properties are not correct.




>>>FWIW my vote would be against throwing exceptions for invalid or missing data.....
>>
>>Why not? Inquring minds wanna know....

>
>Exceptions are expensive. By that I mean that it takes a lot of time to throw/catch them. They probably should not be used for something like validating data. If you can determine that there's a problem by checking stuff, then you should do it. Exceptions are more for errors that are not "checkable" easily any other way. That's a rather simplistic way of looking at it, but I think it's a good rule of thumb.
>
>~~Bonnie
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform