MVP and Validation of User Input
-
I have read alot of articles about the MVP pattern. I have looked a several examples, but I most are pretty trivial. I am wondering where the validation of user input should occur. I am guessing it should be in the presenter, but I am not total sure. I have been using CSLA, which is nice but clunky in some areas. I really like the quick validation responses the user gets when the IErrorProvider interface is implemented, but I don't see a way of doing this without junking up the domain model. Hopefully someone can clear this up or point me to an article. Thanks
-
I have read alot of articles about the MVP pattern. I have looked a several examples, but I most are pretty trivial. I am wondering where the validation of user input should occur. I am guessing it should be in the presenter, but I am not total sure. I have been using CSLA, which is nice but clunky in some areas. I really like the quick validation responses the user gets when the IErrorProvider interface is implemented, but I don't see a way of doing this without junking up the domain model. Hopefully someone can clear this up or point me to an article. Thanks
I've seen the MVP pattern applied in various ways, and the way we apply it here at work may be different than what you're used to. For us, we have validation at several levels: the model object, for example, Employee, "owns" the validation -- you can't make one with bad data. However, we have stuff in place in the presenter to check for valid input (perhaps utilizing the model to determine whether it's valid data), and if it's invalid, update the view accordingly (e.g. highlight the invalid data in red). Something along those lines. Does that help?
Life, family, faith: Give me a visit. From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'" Judah Himango