Skip to content

Comment on What ORMs have taught me: just learn SQL

Comments

This post should be titled "what ORMs have taught me: world is black and white, if you use ORM, you can't use SQL".

Are ORMs leaky abstraction? Yes. All non-trivial abstractions are leaky.

Can you write 95% of code in ORM and drop to raw SQL for 5%? Yes.

This. In the vast, vast majority of cases I prefer writing my stuff with LINQ. The ease of use and type safety is just brilliant. And still for more complex queries or queries that don't perform well enough I still reach for SQL. The point of ORMs is not to obsolete SQL.

All non-trivial abstractions, to some degree, are leaky.

https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-a...

From your link, a remarkable irony:

The SQL language is meant to abstract away the procedural steps that are needed to query a database

Leaky abstractions, all the way down?

I would definitely say SQL is leaky. Certainly not fully declarative. I think it’s important to have escape hatches though - if you have to be leaky you may as well be intentional about it.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.