News for hackers. Stuff that matters.

thymanl23

Re:When Will Coronavirus Social Distancing Be Over? on Sunday March 29, 2020 @10:19AM (#22719181)
The crux of the article: "The answer is simple, if not exactly satisfying: when enough of the population—possibly 60 or 80 percent of people—is resistant to COVID-19"

But then in the next paragraph nonchalantly says "though we don’t yet know if recovering from the disease confers any immunity at all"

I'm not sure sure how articles like these get published.

Re:JavaScript Illustrated: Promises on Friday October 11, 2019 @09:49AM (#21224295)
Check out "The Problem with Promises in JavaScript" [0] for some gotchas with the design of js promises.

[0] https://dev.to/craigmichaelmartin/the-problem-with-promises-...

Re:React made the DOM declarative; Hooks make React declarative on Thursday October 03, 2019 @08:21PM (#21153694)
Hooks are a reconception of state and effects within a declarative model.

Rather than effects being tied to a component's mutable lifecycle, they are tied to the data.

Rather than state being tied to a mutable instance, it is declaratively passed in.

Re:The easiest way to query Postgres in Node.js on Friday September 27, 2019 @11:08AM (#21092791)
The issue I found with the raw SQL approach was receiving back flat results. I made PureORM[0] to do only and exactly that: map flat data to correctly nested business objects.

It is called "pure-orm" both because it is _purely_ an ORM (no query builder api), as well as because it returns _pure_ business objects (instead of db-aware objects).

[0] https://github.com/craigmichaelmartin/pure-orm

Re:What ORMs have taught me: just learn SQL (2014) on Saturday September 21, 2019 @07:32AM (#21034691)
Yeah, ORMs have grown to mean more than mapping relational data to objects. An example of "just" this mapping can be seen in PureORM[0].

[0]: https://github.com/craigmichaelmartin/pure-orm

Re:What ORMs have taught me: just learn SQL (2014) on Saturday September 21, 2019 @07:30AM (#21034682)
The things I've found positive about ORMs are exactly that mapping of results to business objects. The things I've found "not worth it" are the query-building APIs baked into the objects. These principles can be seen in a lightweight ORM I made, PureORM [1].

[1] https://github.com/craigmichaelmartin/pure-orm

Re:To ORM or Not to ORM on Tuesday May 07, 2019 @07:59PM (#19854613)
Or use a "pure orm" (mapping to plain business objects) without a query builder - thus writing native sql and receiving nicely structured objects from the results (eg https://github.com/craigmichaelmartin/pure-orm)
Re:To ORM or Not to ORM on Tuesday May 07, 2019 @07:52PM (#19854584)
> Fortunately, there are tools out there that solve the "mapping tables to objects" problem without trying to control all access to the database

In javascript land there is PureORM which seeks this balance (https://github.com/craigmichaelmartin/pure-orm)

Re:To ORM or Not to ORM on Tuesday May 07, 2019 @07:47PM (#19854561)
The desire for the object mapping (to pure objects, not db-aware objects), while having an aversion to query building APIs led me to use https://github.com/craigmichaelmartin/pure-orm - where native, unobstructed SQL is written in a "data access layer", which returns pure "business objects" to be used in the app's business layer.
Re:Ask HN: Is it reasonable to choose direct SQL over an ORM on Saturday March 23, 2019 @02:19PM (#19471614)
Hmm, yeah, but I think more than just not using a query building api, I prefer pure result objects. Even when dropping to SQL, the result objects are still database-aware objects. I prefer distinct layers between the business domain layer and the data access layer. Having a data access layer return pure business objects allows for this decoupling, but maybe I'm being to strict and forcing a distinction where there doesn't need to be one?
Re:Ask HN: Is it reasonable to choose direct SQL over an ORM on Saturday March 23, 2019 @02:15PM (#19471595)
In an ORM, the returned objects from even raw SQL is still ORM objects (database-aware objects). I prefer keeping the business logic layer distinct from the data access layer, so I prefer for the return objects to be pure business objects. Maybe I'm being too anal and forcing a distinction where there doesn't need one?
Re:Ask HN: Is it reasonable to choose direct SQL over an ORM on Saturday March 23, 2019 @08:26AM (#19470154)
Wow, that sounds like a really neat approach!!

Ask HN: Is it reasonable to choose direct SQL over an ORM

I've been using an ORM for years - and often still find myself frustrated trying to map the complexity and nuance of SQL to an ORM api.What is attractive to me about ORMs, though, is the marshaling of raw result rows into predefined structured objects (preferable pure objects). It seems like if I missed this, I could always reach for something like...

( Read More... | 9 comments | 7 points | on HN )