5 ms·
I like to think of GraphQL as an ORM that hides the complexity of SQL queries. It is a DSL from the logic family. That it happens to be used in web services is
by myegorov 10y ago
I like to think of GraphQL as an ORM that hides the complexity of SQL queries. It is a DSL from the logic family. That it happens to be used in web services is secondary to understanding how it works. Could be used in a different context entirely.
- tveita 10y ago> It is a DSL from the logic family I'm having trouble seeing what features GraphQL gets from the logic family. The query feels more like a way to execute a series of function calls with parameters, like a chain of promises. You can't really encode any logic or do even simple filters like "WHERE foo < bar", beyond what arguments have been added to each field.
- myegorov 10y agoThe essence of logic programming[0] is in enabling a particular kind of exchange. On the one hand, there's a knowlege base -- a specification of what is known in the form of facts/rules/relations. On the other, there's a quest to satisfy some goal. In particular, the query may filter the knowledge base for a particular representation of facts. The query is nothing but a problem statement. In the middle, there's an engine that deduces the answers to queries, however the implementation is hidden from the user. In the ideal world, the user does not concern herself about how the search could be performed at all. The engine would magically produce the answer. (For efficiency's sake, this is not always the case in practice.) GraphQL is built in this spirit. There's an opportunity for a more detailed blog post here. I'll see to it when I get a chance. [0] https://en.wikipedia.org/wiki/Logic_programming https://en.wikipedia.org/wiki/Logic_programming
- Touche 10y agoAh, interesting. So you could have a RESTful API but your server uses GraphQL for the ORM layer, as you say.