Is it a good practise to decouple input checking from a model and have it handled elsewhere, say by a controller? If so, how could this be done from an MVC or DDD standpoint?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is a good practice to perform UI validation.
E.g. if Your domain object expects date time, it is correct if UI part of application ensures it will receive from user correct string, will parse it to date time and pass it to domain object.
Bad example: UI part validates if bank account has enough money for transfer.
However – can’t give any tips how to implement properly this kind of validation in framework You are using (I’m not working with java).
Just don’t keep it in controller. That is not controllers responsibility.