The author critiques SQL, explaining why testing and reusing business logic are challenging with SQL’s limitations. They introduce a solution called functors, composable query fragments with statically-typed interfaces, to address these issues. Functors allow for better testing and reusability by depending on interfaces instead of concrete tables. The author illustrates how functors can improve the testing and implementation of business logic, making queries more readable, testable, and performant. Contrasting views and denormalization, the author argues that functors offer a more effective approach to writing SQL queries efficiently. This innovative solution could revolutionize SQL development.
https://borretti.me/article/composable-sql