by dmitriid · 6y ago · 0 comments
It's great for the frontend, but in this case it's awful for the backend.
> GraphQL allows you to do all of this in a single HTTP request, single SQL query and with 0 lines written by backend developer.
Yeah, right. Because that SQL query will just magically write itself. Especially if that ad-hoc GraphQL query requests extra fields (or doesn't request extra fields) or taps into data that' only available from an external service etc.
You have much more flexibility to solve problems on the back-end. On the front-end, you are fundamentally limited by the fact that you have to transfer all of the data and code to the client-side while the user is waiting.
And once you go you go beyond toy examples on minuscule data, even those magical tools immediately run into problems: https://news.ycombinator.com/item?id=25014918 (note: this is by the author of the comment I replied to) and https://news.ycombinator.com/item?id=25015173
Which conception will magically convert an ad-hoc GraphQL query into "single SQL query and with 0 lines written by backend developer"?
> I don’t see people writing assembly code trying to beat compiler optimiser very often, same thing here.
No idea what you're talking about and how this is relevant
> If anything, we’ll move forward, to more conceptually complex protocol, definitely not back to the plain rest, that I saw many have nostalgia about.
As long as you pretend that GraphQL is magic that requires 0 backend work (but at the same time requires "more competent engineers and a bit of time"), then sure.
So what you are saying is it's better to leave this complexity for the frontend developer to handle on the client side? Very wise!
And yes, GraphQL makes backend significantly more complex, fragile, and prone to significant performance issues.