3 ms·
> Advocating for the use of SQL over an ORM in every case is like advocating for the use of Assembly over C in every case. Comparing SQL to Assembly is probabl
by taffer 7y ago
> Advocating for the use of SQL over an ORM in every case is like advocating for the use of Assembly over C in every case.
Comparing SQL to Assembly is probably one of the worst comparisons you can make. SQL is a very high-level and powerful declarative language that I would compare, if at all, with functional languages and not with assembly. A few lines of SQL are counting, sorting, grouping, aggregating, and merging data that would take dozens of lines if written row by row in a procedural language.
- therein 7y agoYeah, basically an ORM is like a leaky abstraction over an already high abstraction and that's where the problem lies. A better example would be having someone write C macros for you to implement your logic in. Like you can't call `open` to a get a file handle, you need to use the `WRITE_TO_ABSOLUTE_FILEPATH(path, content)` macro every time you wish to write something to a file because someone thought "you know, C is complicated and what are we gonna do, rewrite all uses of open every time we might want to use a different flag". Comes with its own limitations while being sufficient for _some_ people's use cases.
- celticmusic 7y agoan analogy is not about comparing, it's about communicating an idea. pointing out that the comparison is not perfect does not invalidate or refute anything. Every analogy, by definition, is not perfect. If the analogy were to ever become perfect, it would stop being an analogy and would instead be a tautology. "an ORM is like an ORM". IOW, the differences are WHY analogies are useful.
- taffer 7y agoThe point was not that the comparison was not perfect, but that it was utterly wrong. SQL is not at a lower level of abstraction than procedural code, but at a higher level. Abstraction should make complex things easier, not harder.
- celticmusic 7y agoyou're still missing the point. An analogy cannot be wrong because it is not comparing anything. it's communicating an idea.
- jtdev 7y agookay, you win... let’s call it an illogical or even obtuse analogy.