Validator and Constraints

why?

Why you replace code with the same?