Hacker News new | ask | show | jobs
by mrkeen 871 days ago
> SQL doesn't have any form of abstraction at all. It's completely impossible to write reusable, adaptable SQL.

SQL is the abstraction. It's a high-level DSL which saves you from the low-level details of an ORM.

Unfortunately it came out 20 years before the first ORMs, so people default to thinking that ORMS must be an improvement over SQL.

1 comments

> SQL is the abstraction.

SQL is an abstraction in the same way any programming language is an abstraction, but that's beside the point. Within the programming language itself, some support abstraction better than others (and lots of different varieties; it's not well-ordered). SQL basically just doesn't.

> It's a high-level DSL

I agree, but tell that to the people who write the core logic of their entire application in Procedures: that's not very specific. They're using the wrong tool for the job.

> which saves you from the low-level details of an ORM.

This doesn't make sense. The abstraction that SQL is over is the low-level details of how the database query engine works, not an ORM. And an ORM is not "lower level" than SQL. An ORM is just a different abstraction, one that tries to fit more readily into your application language than building SQL strings does. Building SQL strings directly is awful. Get yourself an ORM that allows composition of queries using the abstraction tools available in your language.

It's wild to me that this idea is so controversial that I literally get downvoted for suggesting it, when it's very obviously way better if you try it (or even seriously think about it). It's just an example of how deeply religious database developers are. I don't think any other software engineering sub-discipline is as intolerant of disagreement as database developers.

> people default to thinking that ORMS must be an improvement over SQL

It's not a default judgement. It's 15 years of experience, and tasting the fruit of an ORM done really well. It's also the opinion of the original progenitors of the relational model: EF Codd, Chris Date, etc. (At least, that there vastly better relational abstractions than SQL.) To all you overly religious database developers: guys, your prophets didn't even like SQL!