3 ms·
SQL is both slightly ugly (which I attribute to the historical decision to use natural language words instead of the mathematical symbols of the relational alge
by qwerty456127 5y ago
SQL is both slightly ugly (which I attribute to the historical decision to use natural language words instead of the mathematical symbols of the relational algebra notation - the symbols make the expressions more readable once you learn them) and very beautiful. I'm sad most of the people have forgotten it and prefer to use ORMs today. Most often (except when coding a stupid low-feature phonebook/todolist tutorial) it seems to me writing SQL queries manually is a way more efficient (not only in terms of execution speed but also for developing) solution than using an ORM, except you have to have some fluency in SQL which the most of the today coders seem to lack. Designing a normalized entity-relation model as well as writing the queries for it also feels great, very satisfying.
- lolive 5y agoFrom what I remember, I used to write a lot of JPQL, when I had to to do some Hibernate stuff. isn't it standard way to use ORM? (or do people really traverse their connected objects, creating a load of n+1 select?)
- mritchie712 5y agoA little more detail on the history: https://twitter.com/mike_seekwell/status/1412777805759365120 https://twitter.com/mike_seekwell/status/1412777805759365120
- qwerty456127 5y ago> For people that complain about SQL being hard to read/write... it could have been worse. Thank you for the link. To me, however, this sounds like writing "ADD a TO b" instead of "a + b" and saying using the latter would be worse. Surely the former can be easier for a totally uneducated person to pick up immediately but as soon as you invest some humble time into learning the notation the latter becomes much easier to read than the former.
- mritchie712 5y agoSQL lets you do "a + b". The issue was with the notation, really hard to do that in a text editor.
- qwerty456127 5y ago> SQL lets you do "a + b". When it's about actually adding 2 integers - sure. But when it's about the relational algebra - does it? Can you actually just write ⟖ instead of RIGHT OUTER JOIN when querying a real database? Also, I don't really understand why is it supposed to be hard to do in a text editor.
- da_chicken 5y agoI'm not sure what arbitrary symbols* as operators gets you. "It's built on concepts from relational algebra" does not mean "it must literally be a 100% compatible relational algebra mathematical engine." That is not the purpose of an RDBMS, and the purpose of relational algebra isn't to find a use for sigma, pi, and rho. Nevermind how eye-bleeding the difference between ⟖, ⟕, ⟗, ⋈, ⋉, ⋊, and ▷ will be in a sea of table and field names. (* Yes, I know those symbols are the conventional relational algebra symbols. They were still chosen arbitrarily as notations built on top of the multiplication symbol borrowed as the Cartesian product symbol.)
- qwerty456127 5y agoI just really hate seeing/typing RIGHT OUTER JOIN when it could be just ⟖. It feels like it takes me a microsecond to read the symbol, translating the glyph straight into its meaning in my head instead of subvocalizing it first and thinking what does this mean then. This takes way more time and struggle with the words. Also the whole query consisting of many such words becomes too big to read easily or split into logical parts visually and also looks ugly from the purely aesthetical point of view. To me sea of the SQL language elements represented with words intermixed with table names and other words into one uniform ocean of words seems at least no better than the names intermixed with the distinct kind of symbols (each of which I recognize instantly).
- simonbarker87 5y agoI had to work with TypeORM at my last place and hated it. Prior to that I was at a place with a lot of hand written SQL and while that wasn’t perfect it was much easier to work with
- blacktriangle 5y agohttps://youtu.be/LEZv-kQUSi4?t=483 https://youtu.be/LEZv-kQUSi4?t=483 This talk goes into many anti-patterns, but he gets to the real problem with SQL, that it is ONLY a DSL and lacks either an API or a fundamental information model to program against. Composability when working with a DSL is a nightmare. I also have been moving away from ORM to directly writing SQL, but lets be honest about the reasons that programmers are wary of working directly with SQL as they are legitimate issues.