4 ms·
Well, here's where the difference between query builders and ORMs comes in. Query builders (usually integrated with ORMs) are usually used by people who don't
by hiphipjorge 12y ago
Well, here's where the difference between query builders and ORMs comes in.
Query builders (usually integrated with ORMs) are usually used by people who don't want to write any SQL. SQL is very performant and powerful, but not that easy to understand or write. This is especially so when you think about the context switch between programming languages and SQL.
The advantage of some of the NoSQL databases (MongoDB and RethinkDB, for example) is that you have the luxury of using an ORM only when it makes sense to use it, instead of relying on ORMs as crutch for not knowing SQL.
The second approach seems better, but obviously SQL (power, performance, and prevalence) cannot be ignored.
- nightski 12y agoI disagree. I use ORMs/Query Builders for two reasons (even if deeply familiar with SQL syntax and semantics). 1. Dynamic queries for reporting purposes. Is it possible to hand roll this with SQL string concat for every query? Yes. Some of us value time and correctness. 2. Type safety/Refactoring and change management. Sure even a Query Builder/ORM model doesn't know if it matches the production database at compile time. But when your database does change and you need to update the model to match it then it is a lot easier to do a refactoring on the record than to manually update every SQL query string where that table is involved and hope there isn't a missing test or invalid query out there which will now be broken.