A good class structure for cleaning and using input?
- by ciscoheat
I want to be helpful to the users of a system, so I'll clean up the input a bit before testing if it can be used. So I have a flow like this:
Input: aa12345b
Clean input somehow: 12345
Test if clean input is valid
Use input if valid
Now I want to do this in a beautiful OO-fashion (IoC, interfaces, testable, no statics, you know). Any ideas how to organize a class structure for this? Is it good to have a Cleaner and a Parser/Validator class separately, or put them as methods in the data class itself? Thanks for any help or discussion about this, and extra thanks if the answer is in C#!