3 ms·
After years of programming, I am convinced that complexity cannot be overcome. For any non-trivial application, complexity is inevitable. In my view, we, as de
by kumarvvr 7y ago
After years of programming, I am convinced that complexity cannot be overcome. For any non-trivial application, complexity is inevitable.
In my view, we, as developers, should take up complexity, so that the user is unburdened from it. Ultimately, that is the value addition of software. Remove complexity and improve productivity.
Fundamentally, data is relational and hierarchical, no matter how we store it (Documents / SQL). The value added by GraphQL, and often touted in documentation, is that the client, has control over the shape of the data received from the server. Though packaged in a slightly easier to read syntax, GraphQL is essentially SQL. Sending a GQL query is fundamentally sending an SQL query set, with joins and where clauses, and having a layer of abstraction that understands the query and converts it into lower levels calls to data storage systems.
In my view, this is a more powerful syntax and more flexible than using a REST API. To achieve the same with REST calls, you would have to do something akin to multiple simpler SQL queries, with manual linking of relational data.
I am sure, there will be more innovation in this area, particularly with pairin GQL with Document databases.
- je42 7y agoThe options are not only GraphQL vs REST. In a lot of cases, you can also render server side and push just plain html / components to the client instead.
- korla 7y agoAren't you just moving the client to the backend here? As I understand it we are talking about how whoever needs to render the data gets the data. GraphQL vs. REST vs. whatever is still as relevant in the backend-rendered case.
- je42 7y agoYes, exactly true if you see it from that angle. From your angle, I guess one other alternative to GraphQL and REST would be RPC. ;)
- korla 7y agoIt absolutely is. It is in fact, one of my preferred ways to design systems when doing it in tight coupling between backend and frontend. Such as in a micro-fronted-style vertical. It’s very effective when the needs of the frontend dictate the needs of the backend.