News for hackers. Stuff that matters.
Re:Ask HN: What happened to the ORM? by jasonkester on Thursday June 29, 2017 @06:04AM (#14662009)
But they're unnecessary baggage, because your top six reasons all work in reverse.

If you define your schema in your database and derive your data layer from that, you get everything in your list (apart from that thing that totally always happens where you switch your underlying database technology every few months).

But then you don't have your database defined in two places. And if anybody ever does modify the db by hand, your build will break and it will quickly surface itself as an issue at compile time instead of via an obscure error message somewhere 40 levels deep in the call stack.

Re:Ask HN: What happened to the ORM? by mewwts on Thursday June 29, 2017 @07:14AM (#14662260)
How do you in practice derive the data layer from the schema? Somehow parsing the schema in the application code?
Re:Ask HN: What happened to the ORM? by jasonkester on Thursday June 29, 2017 @07:45AM (#14662418)
Personally, I generate base classes for table objects at compile time.

You can look at a table and its keys to determine what sort of thing it represents (entity, lookup, association, etc.) and build out helper stuff as needed. So in addition to basic CRUD anything that looks like an entity gets .Load(), .Save() and accessors for fields as well as .GetByWhateverID() methods for any foreign keys. I base my actual Entity classes off of those auto-generated base classes, so they can get blown away and recreated as often as necessary.

I also wrap any one-off stored procs that are lying around in calling code, so that they can be used in place of the standard-issue Frankenstein SQLBuilder thing that an ORM would have.

It's kinda all the upsides of an ORM, but without any dynamic garbage, schema-as-config-file, mystery auto-SQL, migrations, or (again) Almost-SQL-In-The-Magic-Query-Languague to Not-The-SQL-I-Meant conversion.

Re:Ask HN: What happened to the ORM? by jacobush on Thursday June 29, 2017 @06:05AM (#14662020)
Thank you.