HGeneAnthony Posted March 28, 2008 Share Posted March 28, 2008 I don't know if this is even an issue, but I was wondering with a public function of a class, do I need to test the arguments to see whether the data is valid even if I test the data before I pass it to the function? For example, I have a class to manage the users in my system. The class is responsible for checking the input it's passed to make sure it's allowed, only after it's done will it send the data to my seperate database class which handles the database details. The database class is set up with public functions so it can receive the data from the user manager class. Nothing else is set up to touch the database class. Do I still need to check the data? Can someone somehow access the database classes public functions in ways I hadn't planned for? I can't think how they would but I'd like to know if this is something I should worry about because I'd like to put a lot of the logic in the user manager class and keep the database class simple. Also this system makes it much easier to use mock objects which I can't do nearly as well otherwise. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.