News for hackers. Stuff that matters.
Re:Is ORM still an anti-pattern? by lovasoa on Tuesday June 27, 2023 @05:13PM (#36498754)
SQL is much more powerful than most people think, and taking an afternoon to learn everything you can do with it is a great investment.

After you do that, you will probably not WANT an ORM anymore, finding that it makes your code less readable than plain sql, not simpler.

Actually, you'll even realize that you may not need anything BUT sql to write your application, using something like (shameless plug) SQLPage [1]

[1] https://sql.ophir.dev

Re:Is ORM still an anti-pattern? by wpollock on Tuesday June 27, 2023 @06:40PM (#36499689)
>SQL is much more powerful than most people think, and taking an afternoon to learn everything you can do with it is a great investment.

SQL is indeed powerful but how can anyone learn SQL well in an afternoon?

Re:Is ORM still an anti-pattern? by lovasoa on Tuesday June 27, 2023 @07:43PM (#36500286)
Maybe I'm mistaken, but I think someone who is already using a relational database through an ORM can learn enough to make powerful queries in an afternoon.

Let's see what we need:

  - SELECT a,b,c FROM table WHERE condition : 1 hour

  - INNER JOIN, LEFT JOIN : 1 hour

  - GROUP BY, HAVING, aggregation functions: 1 hour

  - subqueries, EXISTS : 1 hour

  - recursive queries : 1,5 hours

  - end of the afternoon
You'll probably need to practice a little after that intense afternoon, but I do think that after learning just the five points above, you can become the most knowledgeable person about SQL in your team.
Re:Is ORM still an anti-pattern? by antod on Tuesday June 27, 2023 @09:05PM (#36500948)
You originally said "everything you can do with it" rather than just the basics though. Those goal posts moved pretty far.

I agree with learning most of your examples in an afternoon, but really knowing SQL takes a hell of a lot longer than that. In fact even the most SQL shy ORM preferring devs I've worked with still know those basics.

Re:Is ORM still an anti-pattern? by lovasoa on Wednesday June 28, 2023 @02:40AM (#36503136)
Where do you work? That must be a great place! Most devs I know, even talented ones, have never done a recursive query, and a lot of them don't even know it's possible.