![]() |
| Having worked in big tech and small startups, I think GraphQL is a brilliant way to solve an organizational problem that massive tech companies have. It's that the team maintaining the API is different from the team that needs changes to the API. Due to the scale of the organization the latter doesn't have the access or know-how to easily add fields to that API themselves, so they have to wait for the maintainers to add the work to their roadmap and get back to it in a few quarters. Relevant Krazam: https://www.youtube.com/watch?v=y8OnoxKotPQ At a small start-up, if the GET /foo/:fooId/bar/ endpoint is missing a field baz you need, you can usually just add it yourself and move on. |
![]() |
| > good reasons to divide product teams between frontend and backend? People specialize in different things. A great React developer may not be a great Java developer, and vice-versa |
![]() |
| It sounds like it is promoting a siloed cogs in the machine type of work ethic. Where you are either front end or back end and no one is thinking end-to-end about the system. |
![]() |
| That's generally true for sizable companies. Small companies can and do use full stack devs. Segmentation makes some sense but the industry is lacking end to end thinking as you point out. |
![]() |
| > There just is one version of the API, the one in production! Unless there are multiple in production, i.e /v1/api, /v2/api, etc |
![]() |
| > - Makes caching more challenging since there are now more possible permutations of the data depending on what query the client uses. A hacker could just spam your server's memory with cache entries by crafting many variations of queries. You could use something like https://stellate.co/. > - Makes access control a lot more complicated, slower and error-prone since the query needs to be analyzed in order to determine which resources are involved in any specific query in order for the server to decide whether to allow or block access to a resource. Hasura and Postgraphile can do this - in the case of Postgraphile it obviously requires Postgres. |
![]() |
| And good luck doing that in a language that isn’t JS. All our GQL services were Go, but were forced to use JS for any stitching needs. |
![]() |
| Hmm, there’s really nothing preventing you from writing a library which allows you to pass a data skeleton to an async function and get a full body back. |
![]() |
| I was psyched to hear about GraphQL, but when I looked at it and found no apparent way to do joins... I wondered what the big deal is. |
![]() |
| 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... |
![]() |
| 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. |
![]() |
| 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. |
![]() |
| First, s/opinoin/opinion/ Second, there's a reason DBA (Database Administrator, something like that) is a formal, separate role. If you don't have a DBA it's not because that's a good idea, it's because you (or your bosses) are too cheap to do things well. That's okay, a lot of times cheap is more important than correct. You're still going to need schema. Both NoSQL and GraphQL seem to throw the baby out with the bath water. It was all done before, and Relational Model won. Gotta know your history kids: https://en.wikipedia.org/wiki/Database#History - - - - Tidbit of lore: SQL is not the original language for relational model databases, Codd had a language he called Alpha: https://en.wikipedia.org/wiki/Alpha_(programming_language) SQL is the JS of DBs! |
![]() |
| And in this case usually you can easily opt to exclude the troublesome field with a param, or an endpoint that returns a minimum version of the entity. |