3 ms·
Frontend and backend validation are usually not the same though. You won't be writing the same thing twice, you'll be writing different validations for each.
by ZephyrBlu 3y ago
Frontend and backend validation are usually not the same though. You won't be writing the same thing twice, you'll be writing different validations for each.
- emodendroket 3y agoI think the frontend validations will, most of the time, be a subset of the backend ones, with many shared validation points.
- iainmerrick 3y agoYes, exactly! I’ve several times been in the position of writing a new UI for an existing API. You find yourself wanting to validate stuff before the user hits “submit”, because hiding errors until after submitting is terrible UX; and to do that, you find yourself digging into the server code to figure out the validation logic, and duplicating it. And then years or months later the code gets out of sync, and the client is enforcing all sorts of constraints that aren’t needed on the server any more! Not good.