• jubilationtcornpone
    link
    fedilink
    English
    arrow-up
    25
    arrow-down
    1
    ·
    7 days ago
    • ORM’s
    1. Place ALL of the business logic in stored procedures.
    2. Eliminate the backend.
    3. Make the front end connect directly to the database.
    4. Profit
    5. Introduce tons of bugs and terrible performance.
    6. Database is compromised within five minutes of going live.
    • expr@programming.dev
      link
      fedilink
      arrow-up
      6
      arrow-down
      3
      ·
      7 days ago

      I’m confused. Are you saying all of that is a consequence of not using ORMs? Because if so, that’s absolutely not true. ORMs truly are complete trash.

      • sugar_in_your_tea
        link
        fedilink
        arrow-up
        3
        ·
        6 days ago

        Sounds like you were hurt by an ORM.

        One huge benefit of an ORM is that it does type checking. it makes sure your tables exist, relationships are valid, etc, and it makes easy things easy. If you add a column, it’ll make sure it gets populated, give you decent error messages, etc.

        As long as you use a proper repository pattern setup and isolate DB interactions from the rest of the code, how you construct the queries is completely up to you. I try to use DTOs to communicate w/ the repo layer, so whether an ORM is used or direct SQL queries is largely an implementation detail.

    • aubeynarf@lemmynsfw.com
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      7 days ago

      No, just write a repository to expose domain operations and implements them using SQL directly. Trying to fake OO object graphs against a RDBMS with a super-complex and leaky ORM is just painful.

        • aubeynarf@lemmynsfw.com
          link
          fedilink
          arrow-up
          2
          ·
          7 days ago

          Groovy’s ORM? I recall it being Hibernate under the hood and I had to fight with it to avoid common problems like hidden IO and N+1 query blowups (iterating over a set of results and then touching the wrong property means you are making another network call for each), learning its particular DSL for schema definition and associations, and not having a way to represent any but the simplest SQL constructs. The usual ORM stuff.

          To the extent that you can write a syntax-checked SQL statement and it deserializes the results into some collection of row objects, it’s fine. But that’s not the “ORM” part.

    • Jack@slrpnk.net
      link
      fedilink
      arrow-up
      4
      ·
      7 days ago

      I have for years been pumped to create a sql only side project or sql + frontend