Archived

This topic is now archived and is closed to further replies.

How much integrity checking???

This topic is 5240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In coding my current program, I find that I am writing integrity checks everywhere possible. How much integrity checking is optimal? Is there a time when I shouldnt worry about integrity checking?

Share this post


Link to post
Share on other sites
Any reasonably large program will need and have some form of integrity checking (or exception handling). But if you find yourself checking all over the place then what that means is you don''t have a clear picture of how the program is supposed to work and you are compensating by doing checks ALL the time just to cover your butt... this actually isn''t all that bad during debug but generally it needs to be avoided.

What language are your coding in? If it provides a mechanism of dealing with and detecting errors, then my first suggestion is to use that. Even still you need to have a clear idea of what points in your code the checks need to be at.

Share this post


Link to post
Share on other sites
I basically make a check that everything is ok at each point where the program could unexpectedly crash. i.e.

//create tab control

//generate an error and bail if tab control couldnt be created

//create DirectPlay

//generate an error and bail if Directplay couldnt be initialized

//create childwindow

//generate an error and bail if couldnt create the child window


I do this because I have had problems when running a program on a different machine then my own, and it would close unexpectedly without any sign of what the problem is. With these checks, I (or the user) am able to tell what the problem is (old version of directx etc) I just find that Im doing the checks a lot

Share this post


Link to post
Share on other sites