4 ms·
I often find SQL is extremely good for explaining what you are trying to do. It is of course a declarative language, but more than that it does what a good lan
by gorgoiler 6y ago
I often find SQL is extremely good for explaining what you are trying to do.
It is of course a declarative language, but more than that it does what a good language should do: explain in both directions.
Languages need to tell the machine what to do, and to tell the person reading the code what it was the original author was supposed to be doing. Many bugs happen when the two don’t match up, and the maintainer is often not the person who wrote the original code.
Well written and handwritten SQL is some of the least commented code I’ve seen because it doesn’t need comments — it is self explanatory.
- disgruntledphd2 6y agoMostly, unless the author was enamoured of subqueries, or believes that the only acceptable name for a CTE is cte1, 2 etc. But yeah, as long as you know what the underlying tables look like and what they enforce, then SQL is really easy to maintain and understand.