Yes, the middle ground is great. In TypeScript there’s Kysely or Zapatos (mine), for example.
Absolutely. Dapper is easily the most pleasurable data access solution I have worked with. Developers need to stop pretending SQL doesn't exist and just embrace it.
I think this is the sweet spot. Last time I worked with SQLite on .NET I wrote a wrapper library along those lines: https://github.com/zmj/sqlite-fast
Re:Is ORM still an anti-pattern?
by calvinmorrison on Tuesday June 27, 2023 @08:28PM
(#36500663)
Personally I like not having to either write my own model functions which just map back to sql, or having to write a boilerplate php to do parameterized queries correctly. Eloquent abstracts enough of that crap out of my way i can focus on the logic.
Sincerely someone rewriting an 'old' php app that is just arrays and queries to something using models and eloquent, what a game changer
Eloquent is one of the worst ORM I worked with. It works until it doesn't, there is too much magic and it mixes SQL/Entity in the same class. Since then I use doctrine and/or repository pattern which makes the code more extensible and testable, it's also trivial to do your own raw SQL request and map it to your entity if you don't want to rely on an ORM.
Write your queries in SQL, but you get to have your strong typing and automatic result set to objects mappings. Productivity combined with the full-featured “real” query language.
Also, I’ve become a fan of using the object mappers only for read-only queries. Updates occur via the command pattern — stored procedures. These can be mapped through to look like native methods.