Live data from Hacker News

What ORMs have taught me: just learn SQL (2014)

wozniak.ca

111–120 of 354 posts

Re: What ORMs have taught me: just learn SQL (2014)

#111
post #92

Earlier quoted context omitted.

Looks like I’m not the only one, check the thread.

Still just anecdotes. Who cares about those

You’re on a forum where people share anecdotes, so presumably, you?

Are you dumb or are you just pretending? I’m going to guess the former!

Re: What ORMs have taught me: just learn SQL (2014)

#112
Why not both? ORMs for the simpler CRUD operations, SQL when it gets a little hectic.

The author basically says this in the first paragraph, but the title (and some of the language the author uses) implies that people should just use SQL.

It's a reasonable article pointing out some of the annoyances and problems of ORMs (especially in the Java world, where they tend to be overengineered) but there are still a lot of advantages to them if you are in an OO language and they used in a reasonable way.

Re: What ORMs have taught me: just learn SQL (2014)

#113

As someone who started their programming journey with SQL, it just feels so odd hearing about learning SQL being presented as an useful option. I get it, it just feels odd. SQL was considered table stakes in the financial IT world - if you said you didn't know SQL, people would look at you funny.

It's very strange too. You can learn something like ~90% of useful SQL in an afternoon. The remainder is stuff that you only really need for extremely performance sensitive operations

That is exactly what I was thinking. There is such a low barrier to entry with an outsized payoff.

Re: What ORMs have taught me: just learn SQL (2014)

#114

Earlier quoted context omitted.

> Folks who dislike ORMs seem to have this false dichotomy that "the ORM _must_ be used for all queries", which is a self-imposed/unpractical restriction my experience is the exact opposite. People who love and advocate the merits of ORM insist that everything be executed through ORM because it introduces too much complexity for them to blend handwritten SQL with the ORM generated queries

I've written/worked on several ORMs from scratch. ORMs are the industry standard. When I see posts like this I simply can't take them seriously. All they are saying is "I won't be a team player" and "I don't actually understand the subject matter". The reality is at a certain scale there's an entire orm team that optimizes everything. But even when there's no team involved there's no way you can write anything more o…

> All they are saying is "I won't be a team player" and "I don't actually understand the subject matter".

I get the first part, but not the second.

Preferring to use SQL rather than an ORM + SQL is all about understanding the subject matter, which is the data as it exists in the database.

> The tldr is if you're ever concatenating strings in order to build a query you're just doing what the entire job of orm is but rolling your own and chances are you'll end up with a bunch of bugs in how you handle well.... Everything.

Yeah, so basically don't do this, except when you have to, like concatenating placeholders for a variable size IN query.

There's some classes of applications where it's hard to write all the queries because there's all sorts of mix and match stuff happening. Those are pretty much doomed to poor performance if the tables are large, so I would rather not play on those teams. On the bright side, the limit of a small table gets bigger every ram generation, and table scans on nvme aren't so painful either.

Re: What ORMs have taught me: just learn SQL (2014)

#116

I used to love ORMs so much that I built one for Java, in the early 90s, and it was one of the main offerings of a startup that I joined. I have come around 180 degrees. My rethink started when a developer at a Wall Street bank said: having Oracle on my resume is valuable. Having your ORM on my resume is not. And then there’s the “now you have two problems” dynamic. You not only have to write high-performing queries,…

> built one for Java, in the early 90s

So was your ORM for Oak? Java didn't hit the public sphere until 1995 IIRC

Re: What ORMs have taught me: just learn SQL (2014)

#117
post #6

2014: people respond with indignance that they should have to learn SQL now that there's a shortcut 2026: people respond with indignance that they should have to learn anything now that there's a shortcut

I like SQL. I enjoy writing SQL. I find ORMs produce crap SQL. But the current shortcut du jour is pretty damn good at writing SQL.

[deleted]

Re: What ORMs have taught me: just learn SQL (2014)

#119
>just learn SQL

Implying I use an ORM because I don't know SQL... I've reverse engineered embedded databases and written directly to the .dat files on production systems that deal with HIPAA data. I'm pretty sure I know SQL better than most people on HN. I still prefer an ORM.

Why? Because with my ORM, I can code gen faster than you can vibe code. I can build on top of the abstraction layer. The data model in the ORM is the M in MVC. The backend could be a SQL database, a file system, a REST service, that part is irrelevant. The M is the same, regardless of the backing store. View and Controller code still works.

I find most people who are anti-ORM are kinda junior and trying to flex their power to write SQL scripts as if it is impressive. That's why there's always this weird implying that ORM users don't know SQL.

Re: What ORMs have taught me: just learn SQL (2014)

#120
post #114

Earlier quoted context omitted.

I've written/worked on several ORMs from scratch. ORMs are the industry standard. When I see posts like this I simply can't take them seriously. All they are saying is "I won't be a team player" and "I don't actually understand the subject matter". The reality is at a certain scale there's an entire orm team that optimizes everything. But even when there's no team involved there's no way you can write anything more o…

> All they are saying is "I won't be a team player" and "I don't actually understand the subject matter". I get the first part, but not the second. Preferring to use SQL rather than an ORM + SQL is all about understanding the subject matter, which is the data as it exists in the database. > The tldr is if you're ever concatenating strings in order to build a query you're just doing what the entire job of orm is but r…

We're pointing out the same thing. Someone that uses an ORM knows when they shouldn't use them and I tend to trust that more than someone who simply refuses to use them and ends up recreating an ORM by accident.
Post reply on HN