GraphQL kinda sucks
720 pointsbut beginner to mid level developers are lead down the path of USE GRAPHQL especially on youtube... and this is just unfair and wrong.
The good:
- It makes working with describing the data you want easy
- It can save you bandwidth. Get what you ask for and no more
- It makes documentation for data consumers easy
- It can make subscription easier for you to use
- Can let you federate API calls
The bad
- It is actually a pain to use, depending on the backend you are using you'll have to manage
two or more type systems if there are no code first generates in your language
- It doesn't support map/tables/dictionaries. This is actually huge. I get that there might be
some pattern where you don't want to allow this but for the majority of situations working with json api's you'll end up with a {[key: string] : T} somewhere
- No clear path for Api versioning you'll end up with MyQueryV1.01 MyQueryV1.02 MyQueryV1.03
Don't use Graphql unless you're managing a solution/problem set that facebook intended graphql for
Invest your time in a simpler solution then running to GraphQL first
thanks for reading my ted talk
please any senior dev's drop your wise words so that any new dev's can avoid tarpits
Comments (433) 114 threads
Earlier commentsOption 1: return a property list. In other words, a list of objects that have a key and a value. It’s easy write a getter function to search by key, or convert it to a map outright.
Option 2: make a Json custom “scalar”, send back whatever dynamic structure you want.
I hated the namespaces on the code-generated classes and ended up manually wrapping them, obviating the benefit.
It was also super brittle, when the back end would change something it would break the clients.
- There's really no need for API versioning in GraphQL. Just keep iterating on the fields.
Pros:
- front-end implementation is near-trivial. I re-wrote half of my framework because I wasn't happy with it in a few days.
- can use some cookbooks for some good front-end patterns
- overall very easy to use, and very easy to extend front-end stuff
Cons:
- Poor back-end implementations. JSONApi Resources kinda sucks. Graphiti might be significantly better.
- No clear pattern for submission of data. You don't want your front-end to contain operational logic, dumb front-ends are the way to go (front-ends do what they are told, they don't make decisions).
- Not the "IT" thing, so not too much big corporate money backing it. :( This is actually kind of a big deal.
All comments shown.
Couldn't load more comments. Check your connection and try again.