News for hackers. Stuff that matters.
Re:GraphQL kinda sucks by endisneigh on Saturday August 06, 2022 @08:55AM (#32367666)
What exactly is the simpler solution that doesn’t result in your same cons mentioned?
Re:GraphQL kinda sucks by thomassharoon on Saturday August 06, 2022 @09:53AM (#32368091)
There are patterns that can get you the same benefits without having to use GraphQL.

Even on a REST API, you can achieve the same pros

> - It makes working with describing the data you want easy > - It can save you bandwidth. Get what you ask for and no more

You can describe the fields you need (and I assume that is what reduces the bandwidth)

GET /users?fields=name,addresses.street,addresses.zip

> - It makes documentation for data consumers easy

I don't think so in practice. You can see Shopify's GraphQL documentation [1]. If anything it is more complex than their REST API docs

> - It can make subscription easier for you to use

Not too different from using something like SSE or even websockets and every decent web framework seems to have a decent implementation

> - Can let you federate API calls

So many ways to achieve this at the application layer (which is what GraphQL federation does with a Router). In the python world this could be separate WSGI apps or racks in ruby? And makes no difference if done at the load balancer level.

[1] https://shopify.dev/api/admin-graphql/2022-07/enums/localiza...

Re:GraphQL kinda sucks by endisneigh on Saturday August 06, 2022 @11:59AM (#32369188)
There a lot of ways to do the same thing as GraphQL. The point is if it’s as easy.
Re:GraphQL kinda sucks by hestefisk on Saturday August 06, 2022 @09:45AM (#32368022)
SQL statements wrapped in function calls.
Re:GraphQL kinda sucks by JohnHaugeland on Saturday August 06, 2022 @09:01AM (#32367711)
Making a regular api
Re:GraphQL kinda sucks by endisneigh on Saturday August 06, 2022 @09:05AM (#32367743)
A regular api poorly implemented will have all the same cons and none of the pros.
Re:GraphQL kinda sucks by geysersam on Saturday August 06, 2022 @09:12AM (#32367776)
Just make a perfect api without any drawbacks.
Re:GraphQL kinda sucks by endisneigh on Saturday August 06, 2022 @10:07AM (#32368213)
GraphQl has a set of trade-offs. REST also has trade-offs. Bespoke RPC calls have trade offs. It's as if the entire discipline is an exercise in selecting trade offs or something.
Re:GraphQL kinda sucks by anotherhue on Saturday August 06, 2022 @10:52AM (#32368622)
Well put. Problem is we can get emotionally invested and tie our identities to these systems in a way that we couldn't if we were comparing the trade-offs between 18/10 and 18/12 inox steel.
Re:GraphQL kinda sucks by JohnHaugeland on Saturday August 06, 2022 @09:17AM (#32367810)
> A regular api poorly implemented will have all the same cons and none of the pros.

Okay, so don't make a poorly implemented one?

Also, no, it kind of won't. Let's look at what they are again

.

"It is actually a pain to use"

Not an API characteristic

.

"you'll have to manage two or more type systems if there are no code first generates in your language"

Not an API characteristic

.

"It doesn't support map/tables/dictionaries."

Not an API characteristic

.

"No clear path for Api versioning"

Not an API characteristic

.

Looks like it's actually zero for four

Re:GraphQL kinda sucks by gabereiser on Saturday August 06, 2022 @09:32AM (#32367938)
In order to build a properly implemented one, one must first learn to build one. I find most people jump onto graphql because they see the volume of work to create crud endpoints for all of their models and decided to punt.
Re:GraphQL kinda sucks by legalcorrection on Saturday August 06, 2022 @09:37AM (#32367978)
It’s a false promise. You’re just moving the complexity elsewhere, into wiring this ridiculous graphql infrastructure together and making it actually do what you want in all but the simplest/tutorial-like scenarios.
Re:GraphQL kinda sucks by intelVISA on Saturday August 06, 2022 @09:47AM (#32368040)
Seriously. I sometimes think I'm visiting a satirical alter realm when I see these obtuse systems that end up requiring more cognitive energy to glue together than the regular version in <lang of your choice here> being praised rather than derided.
Re:GraphQL kinda sucks by lelanthran on Saturday August 06, 2022 @10:17AM (#32368305)
> I sometimes think I'm visiting a satirical alter realm when I see these obtuse systems that end up requiring more cognitive energy to glue together than the regular version in <lang of your choice here> being praised rather than derided.

You're lucky, you're only visiting. I'm working in that alternate reality :-)