Live data from Hacker News

ORMs are nice but they are the wrong abstraction

workdad.dev

1–10 of 70 posts

Re: ORMs are nice but they are the wrong abstraction

#4

Couldn't agree more and I just recently had few comments on the topic. Everytime I use ORMs I feel frustrated by the capabilities compared to raw sql. I feel handicapped in being able to have the data in a way I want.

SQL is so flexible. When I put myself as a user, I also prefer those tools that provide nice UI for filter/reporting, but also give me SQL interface to do advanced query, such as PostHog, Resmo, JIRA(?)

Re: ORMs are nice but they are the wrong abstraction

#6
ORMs are useful when what you want to do matches their expressiveness. For example when I just want to get a record by its primary key. They have their limits, many times when doing complex reports. For that, most ORMs provide a raw SQL function. So just use the right tool for the job.

Stored procedures for business logic can be great for performance when they replace queries/mutations called thousands+ times.

Re: ORMs are nice but they are the wrong abstraction

#7

Couldn't agree more and I just recently had few comments on the topic. Everytime I use ORMs I feel frustrated by the capabilities compared to raw sql. I feel handicapped in being able to have the data in a way I want.

ORMs never block you from issuing raw SQL queries. But mapping the results to entities inside your programming language’s abstraction is a repetitive task, ready to be abstracted away. The reverse direction is the same way.

I feel most of the criticism of ORMs come from people who don’t actually know how to properly use one. They were never meant for OLAP, they are for OLTP.

Re: ORMs are nice but they are the wrong abstraction

#8
post #5

How about move the business logic to stored procedures

Writing my business logic with no libraries, no standard testing framework, and a syntax and overall feel comparable only to COBOL? No thanks.

(Some databases allow writing stored procedures in other languages, true, but that means a nonstandard interface, tightly coupled deployment model, and testing is still awful)

Re: ORMs are nice but they are the wrong abstraction

#10
post #8
post #5

How about move the business logic to stored procedures

Writing my business logic with no libraries, no standard testing framework, and a syntax and overall feel comparable only to COBOL? No thanks. (Some databases allow writing stored procedures in other languages, true, but that means a nonstandard interface, tightly coupled deployment model, and testing is still awful)

There is e.g. https://pgtap.org/ as a testing library for Postgres.
Post reply on HN