• bort@sopuli.xyz
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    15 hours ago

    the problem with ORM is that some people go all in on it and ignore pure SQL completely.

    In reality ORM only works well for somewhat simple queries and structures, but at some times you will have to write your own queries in SQL. But then you have some bonus complexity, that comes from 2 different things filling the same niche. It’s still worth it, but there is no free cake.

    • elkien@lemmy.today
      link
      fedilink
      arrow-up
      5
      ·
      12 hours ago

      I’ve always seen as that as a scapehatch for one of the most typical issues with ORMs, like the the N+1 problem, but I never fully bought it as a real solution.

      Mainly because in large projects this gets abused (turns out none or little of the SQL has a companion test) and one of the most oversold benefits of ORMs (the possibility of “easily” refactor the model) goes away.

      Since SQL is code and should be tested like any other code, I rather ditch the whole ORM thing and go SQL from the beginning. It may be annoying for simple queries but induces better habits.