Readit News logoReadit News
ckmar commented on Is Product Search Broken? Why Are We Still Stuck with Ads and Fake Reviews?    · Posted by u/nicola_alessi
ckmar · 9 months ago
Have you seen unfluence? https://unfluence.app
ckmar commented on Show HN: Unfluence – A private social graph for trusted recommendations   unfluence.app/... · Posted by u/ckmar
ckmar · 9 months ago
Read the manifesto [0] or check out the product walkthrough video [1].

[0] https://unfluence.app/about

[1] https://www.youtube.com/watch?v=mFZ8zcF8r8M&ab_channel=Craig...

ckmar commented on Don't use your ORM entities for everything – embrace the SQL   blackparrotlabs.io/post/a... · Posted by u/bubblehack3r
ckmar · 2 years ago
Have you seen Pure ORM? It's an ORM that purely does object relational mapping.

You write SQL but instead of getting back flat and potentially-collided data, you get back pure objects which are properly structured.

https://github.com/craigmichaelmartin/pure-orm

ckmar commented on Python: Just Write SQL   joaodlf.com/python-just-w... · Posted by u/joaodlf
zzzeek · 2 years ago
ORMs do much more than "write SQL". This is about 40% of the value they add.

As this argument comes up over, and over, and over, and over again, writers of the "bah ORM" club continuously thinking, well I'm not sure, that ORMs are just going to go "poof" one day? I wrote some years back the "SQL is Just As Easy as an ORM Challenge" which demonstrates maybe a few little things that ORMs do for you besides "write SQL", like persisting and loading data between classes and tables that are joined in various very common ways to represent associations between classes:

https://gist.github.com/zzzeek/5f58d007698c4a0c372edd95ab8e0...

this is why whenever someone writes one of these "just write SQL" comments, or wow here a whole blog post! wow. I just shake my head. Because this is not at all what the ORM is really getting you. Plenty of ORMs let you write raw SQL or something very close to it. The SQL is not really the point. It's about the rows and objects, moving the data from the objects to the INSERT statement, moving the data from the rows you SELECTed back to the objects. Not to mention abstraction over all the other messy things the database drivers do like dealing with datatypes and stuff like that.

It looks like in this blog post, they actually implemented their own nano-ORM that stores one row and queries one table. Well great, now scale that approach up and see how much fun it is to write the same boilerplate XYZRepository / XYZPostgresqlRepository code with the same INSERT / SELECT statement over, and over again. I'd sure want to automate all that tedium. I'd want a one-to-many collection too maybe.

You can use SQLAlchemy (which I wrote) and write all the SQL 100% yourself as literal strings, and still use the ORM, and still be using an enormous amount of automation to deal with the database drivers and moving data between your objects and rows. But why would anyone really want to, writing SQL for CRUD is really repetitive and tedious. Computer can do that for you.

ckmar · 2 years ago
> The SQL is not really the point. It's about the rows and objects, moving the data from the objects to the INSERT statement, moving the data from the rows you SELECTed back to the objects.

If anyone is looking for this "pure" ORM (no query builder API) in Node there is https://github.com/craigmichaelmartin/pure-orm

ckmar commented on Strict error handling in JavaScript with a functional try   github.com/craigmichaelma... · Posted by u/ckmar
ckmar · 2 years ago
One line of code which is specific in what it catches:

    // Either foo or someError will be defined
    const [foo, someError] = itry(someFn, SomeError);
Instead of nine lines which feel like they are working uphill against the language: dealing with variable scoping issues, deeper nesting, and footguns like forgetting to re-throw.

    let foo;
    try {
      foo = someFn();
    } catch (err) {
      if (err instanceof SomeError) {
        // do something with error
      } else {
        throw err;
      }
    }
    // use foo

u/ckmar

KarmaCake day82April 16, 2021View Original