News for hackers. Stuff that matters.
Re:Is ORM still an anti-pattern? by jiggawatts on Tuesday June 27, 2023 @04:39PM (#36498334)
I’m a big fan of the “middle ground” micro-ORMs like Dapper or Diesel.

Write your queries in SQL, but you get to have your strong typing and automatic result set to objects mappings. Productivity combined with the full-featured “real” query language.

Also, I’ve become a fan of using the object mappers only for read-only queries. Updates occur via the command pattern — stored procedures. These can be mapped through to look like native methods.

Re:Is ORM still an anti-pattern? by gmac on Tuesday June 27, 2023 @04:45PM (#36498391)
Yes, the middle ground is great. In TypeScript there’s Kysely or Zapatos (mine), for example.
Re:Is ORM still an anti-pattern? by mvdtnz on Tuesday June 27, 2023 @04:59PM (#36498567)
Absolutely. Dapper is easily the most pleasurable data access solution I have worked with. Developers need to stop pretending SQL doesn't exist and just embrace it.
Re:Is ORM still an anti-pattern? by zmj on Tuesday June 27, 2023 @08:17PM (#36500583)
I think this is the sweet spot. Last time I worked with SQLite on .NET I wrote a wrapper library along those lines: https://github.com/zmj/sqlite-fast
Re:Is ORM still an anti-pattern? by calvinmorrison on Tuesday June 27, 2023 @08:28PM (#36500663)
Personally I like not having to either write my own model functions which just map back to sql, or having to write a boilerplate php to do parameterized queries correctly. Eloquent abstracts enough of that crap out of my way i can focus on the logic.

Sincerely someone rewriting an 'old' php app that is just arrays and queries to something using models and eloquent, what a game changer

Re:Is ORM still an anti-pattern? by BafS on Wednesday June 28, 2023 @04:21AM (#36503782)
Eloquent is one of the worst ORM I worked with. It works until it doesn't, there is too much magic and it mixes SQL/Entity in the same class. Since then I use doctrine and/or repository pattern which makes the code more extensible and testable, it's also trivial to do your own raw SQL request and map it to your entity if you don't want to rely on an ORM.