Alex Rivera | Logout

Is it practical to have back-end (database side) validation for everything?

Asked 2013-06-11T08:47:52.363
18

With Back-end validations I mean, during the- Triggers,CHECK, Procedure(Insert, Update, Delete), etc. How practical or necessary are they now, where nowadays most of these validations are handled in front-end strictly. How much of back-end validations are good for a program? Should small things be left out of back-end validations?

For example: Lets say we have an age barrier of peoples to enter data of. This can be done in back-end using Triggers or Check in the age column. It can/is also be done in front-end. So is it necessary to have a back-end validation when there is strict validation of age in the front-end?

Edit
Report

1 Answer

4

Put contraints on your database. This is NOT business validation, more like data validation, for example - foreign key constraints, or making sure your primary keys are unique. It's making sure your data is consistent.

The validation you are talking about is business validation, and this kind of validation should be in your business layer, for example in your domain, and should be the main source for validation. If these rules change, you modify them in the business layer and all of your clients immediately are affected.

In the UI you could/should also do basic input validation - like checking mandatory fields, or validity of an email address; and updating or disabling UI controls based on that. I would say that this is the kind of validation that doesn't change (a lot).

answered 2013-06-11T08:52:28.273

Your Answer