are we to feel Taco Bell menu about it all, what am I missing?
are we to feel Taco Bell menu about it all, what am I missing?
Mystery triggers, unclear or badly managed stored procedures, opaque invariants. It’s not to say that all of these things are bad, but a certain level of DB complexity will naturally set off alarm bells for some devs.
Our Industry pretends solutions must be immediately understandable with common sense, without study or explanation. But nothing that actually matters does this (relational databases in the first place).
No other engineering discipline has this confusion. The world has complexity and it’s our job to understand it.
It is tedious to specify all that information (access, constraints, foreign key, cascading, views), but it’s all essential information you would end up specifying in another way.
The cycle in tech will shift from one side to another; last decade was a lot of no-sql where all this logic and implementation had to reside on the application side. I'm seeing a shift back to DBs again (e.g. supabase), and the reality is that it's probably a continuum somewhere in-between, depending on your requirements (as always, the answer is "Yes, but it depends").
Remember, these are all "just" tools.
A small fraction of people bothered to learn how they work and know how and when to use them properly.
Everyone else just perpetuates a giant in-joke of “it’s black magic!”
It seems to me that we have the abstraction inverted when it comes to ORMs, which is why so many experienced devs dont like ORMs (but can't really articulate why).
Here's my take, in the context of business logic:
The schema represents the business rules. The ORM papers over the DB so that the code doesn't have to match the business rules. Then the dev implements those rules again in code, but poorly.
If you simply skip the programming language using something like Postgrest you end up with a declarative structure of the business rules.
The first problem is that most developers would rather hunt a bug or perform a modification on a 30k Java or C# or python or ruby program than in 5k of SQL.
The next problem is that tooling for SQL is crap. It's declarative so good luck stepping through the logic. The dialects are all different so editors aren't great at spotting errors.
The last major problem is that changing it is hard - you can't simply change the schema and redeploy because migrations have to be made on the existing data.
All of these are surmountable in some ways, but they certainly ain't easy.
Doing LoB apps have opened my eyes a lot: maybe 99% of logic is shorter when expressed in SQL. Of course, that means that the only use of an ORM in this case is connecting to the DB, sending the query, and sending back results.