Re:Consistency is Consistently Undervalued
by tptacek on Saturday September 24, 2016 @12:37PM
(#12571550)
That's not ESR's point. It's shoplifted from Brooks.
Re:Consistency is Consistently Undervalued
by tscs37 on Monday September 19, 2016 @05:44AM
(#12530094)
IMO validating in the DB also makes code faster.
When I get data from a well validated DB, I don't have to check that it is valid or has certain formats, that is ensured by the DB.
I can remove checks from the entire CRUD stack, if it's invalid data it does not get created or won't make it into the update.
The easiest way to check data is then to try the INSERT or UDPATE and if it works it's valid.
Otherwise I'd need to validate all fields, see if any contain errors, if any are missing, etc etc.
Reading your comment reminds me of ESR's point in The Art of Unix Programming that getting the data structures right is more important than getting the code right, and if you have good data structures, writing the code is a lot easier. The database is just a big data structure, the foundation everything else is built on, and the better-designed it is, the easier your code will be.