3 ms·
Pretty much this sums it up. I still don't understand the need for graphql. Then again, it only takes me 5 minutes to add a new endpoint that just dumps back
by dhzhzjsbevs 4y ago
Pretty much this sums it up.
I still don't understand the need for graphql.
Then again, it only takes me 5 minutes to add a new endpoint that just dumps back a specific SQL query result.
I think a lot of companies make adding endpoints into a big deal, often a whole new file or class with documentation and tests.
An SQL query doesn't need tests.
I think another part of it is that SQL still scares people. That is, I'd put graphql in the same camp as active record, orms, and other silly attempts at creating a query language to avoiding using a query language.
- eurasiantiger 4y ago>An SQL query doesn't need tests. Have you ever done financial stuff on SQL? Transaction processing or even just CRM/billing? Spend 15 minutes imagining a single query that fetches invoices, combines them with bank transaction data and produces a categorized list of unpaid-but-not-late, unpaid-and-late, not-fully-paid-but-not-late, not-fully-paid-and-late, fully-paid-in-time and paid-too-much invoices for this year’s billing cycle, selected from tables that contain info for all historical years too. You want to have tests for those.
- dhzhzjsbevs 4y agoYou'll need tests for those on graphql too. I was referring to how hard some companies make it to ship basic code. The graphql setups I've had to work with are all far more complicated than a function that returns an array and if your framework needs more than that to dump it out on an http request, you've got problems, but SQL isn't it.
- eurasiantiger 4y agoGraphQL also has advantages that are otherwise difficult to realize, at least without an API schema. Request and response validation and object-level caching come to mind. How would you otherwise share cached objects between API endpoints? Need to set up a custom redis integration. With GraphQL, such things often come in nicely wrapped packages.