3 ms·
> When interacting with the database you either use an ORM with your strongly-typed business objects If you have strongly-type business objects then why not h
by hans_castorp 6y ago
> When interacting with the database you either use an ORM with your strongly-typed business objects
If you have strongly-type business objects then why not have a strongly typed storage? If you code can control the constraints that a correct data type ensures, then why have "strongly type business objects" to begin with? Why not store everything in your code as strings as well?
I see this misconception all the time. The database (and its data) lives way longer than most applications. And it's also a wrong to assume that there is always only one application accessing the database. Bulk loads are a typical case of secondary applications.
Not choosing the proper data type in a relational database is a really bad decision and we see question on stackoverflow and similar sites on a weekly (if not daily) basis asking how to fix invalid data in those "un-typed" columns.
- yread 6y agoI'm not saying it's useless to have type constraints in a database. Just that with a bit of care it's not such a big deal. In the end there will always be some business rules that are not constrained by the database. So, you always have to be a bit careful about what you store in it. Indeed not being careful and hoping that your types, constraints and triggers are going to save you is more risky > Not choosing the proper data type in a relational database is a really bad decision Well, then rejoice, you can't make this bad decision in SQLite because everything is +/- a number or a string