This is a pragmatic piece of Fowler on the rather dry topic of Object-relational mappings - in short, the attempt to marry an object-oriented code base with a relational data base.

Usually you’d get enough early success to commit deeply to the framework and only after a while did you realize you were in a quagmire - this is where I sympathize greatly with Ted Neward’s famous quote that object-relational mapping is the Vietnam of Computer Science

What Fowler refers to here, is Ted Neward’s article “The Vietnam Of Computer Science”

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    2 hours ago

    I’ve never worked on a codebase where using ORMs wasn’t better than rolling your own queries. What are people writing that they actually need the marginal performance gains? And even if that’s worth it, why not just use raw queries in your critical paths?

    Every time I have to write or modify raw SQL it feels like I’m throwing away all my static checking features and increasing the chance of bugs, because I have no idea of the query matches my schema or if it’ll blow up at runtime.

  • cecilkorik@lemmy.ca
    link
    fedilink
    English
    arrow-up
    7
    ·
    5 hours ago

    Two choices always seem to end up as the fate of any large scale, long-term developed database application. Either you use an ORM, or you build your own piece by piece. I know which one makes more sense to me.

    • Maestro@fedia.io
      link
      fedilink
      arrow-up
      4
      ·
      4 hours ago

      Same goes for any application that are proud to use “no framework”. It just means that you partially implemented your own poorly documented half-assed framework.

  • moonpiedumplings@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    5 hours ago

    I like ORM’s because they prevent sql injection. Mostly. Sql injection is a really bad vuln that’s nowhere near as ubiqitous as it used to be for every php app, and that’s partly due to ORM’s.

  • e8d79@discuss.tchncs.de
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    5 hours ago

    I consider the ORM hate uninformed and misguided at best. Just like any other technology not all of them are created equally there are better ones and worse ones. I have used Entity Framework Core for years and have almost no complaints but If I only knew ORMs like NHibernate then I might have a different opinion.

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    4 hours ago

    ORMs are a pain and so is hand rolling SQL queries and doing the mapping manually.

    I definitely think there’s scope for NoSQL databases where the database “shape” matches the normal struct style of programming languages. Kind of like how JSON does and XML doesn’t.

    But it seems like all we got was MongoDB and Firebase which are both shit.

    Are there any good NoSQL databases? MongoDB and Firebase don’t even have schemas.

  • Olap@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    6 hours ago

    Having seen what the ORM hate leads to. Just use the ORM folks. Far better in the long to do so! Nothing has come close to ActiveRecord imo in Typescript or Python sadly. Unless anyone has a library or two I should check out?

    • hperrin@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 hours ago

      You can check out my library, Nymph.js. It’s what powers Port87.

      Unfortunately, I don’t have a whole lot of open source code showing how to use it, since it was developed specifically for Port87, which isn’t open source. But there are test files that show how to use it.

    • HaraldvonBlauzahn@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      ·
      6 hours ago

      Haven’t tried it, but functional programming methods (as in Clojure) combined with Datomic / Datalog sound interesting. It is said to be quite good.

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    4 hours ago

    I’m starting to think more that I shouldn’t call my library, Numph.js, an ORM. It technically is one, but it’s very different than other ORMs. A lot of the stuff he’s talking about here doesn’t apply to Nymph (for better or for worse). I just don’t know what to call it though.