Live data from Hacker News

Facebook Relay: An Evil And/Or Incompetent Attack on REST

pandastrike.com

131–140 of 166 posts

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#131
post #120

Earlier quoted context omitted.

The problem is that traversing a HATEOAS graph (like the www) requires a request at each edge. (The query is only the entry point to the graph, it doesn't help you traverse the graph. Relational joins make it so you don't need to traverse the graph, but this requires a lot of custom endpoints that bake in up-front knowledge about which nodes of the graph will need to be pre-fetched) edit: Either you edited or I misre…

As someone with a bit more experience with these technologies, would you please describe what GraphQL actually has to do with graphs? I work with very, very large graphs. I looked at GraphQL to see if it could be of use, but as far as I can understand the graph aspect of GraphQL is marketing multiplied by doublespeak. RDF and Sparql seem to be much more apt systems in this space. So I would appreciate if you opined b…

GraphQL lets you represent your API as a graph. You do this by defining a set of types that have fields in them which resolve to instances of other types. For example, if you have a "Person" type with a "friends" field that resolves to more people, you could traverse this as deeply as you wanted, like so:

query { me { friends { friends { friends { friends { name } } } } } }

That would get you the names of my friends of friends of friends of friends. It's a directed graph where you can traverse as many edges as you want in any direction in a single query. It's like a power tools version of your usual REST API.

What more are you expecting?

(in relay this would look a bit different due to the "connection" spec, but you're free to define a graphql endpoint this way too)

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#132

Earlier quoted context omitted.

Nonsense. A URL is a resource endpoint. If a resource is a composition of other resources, it is perfectly acceptable to return all composed resources. Let's try an example: A shopping application, with customers, products and orders. An order composes a customer and all products that were ordered. You'd have endpoints for retrieving a customer (/customer/ /), a product (/product/ /) and an order (/order/ /). When re…

> Pass in "Accepts: application/json+order+deep" or "Accepts: application/json+order+plain" from the client side signaling the kind of response you want from the server. This is an interesting approach, but I'm wondering how this interacts with caching: how does the client properly differentiate between the two calls ? (I guess the 'Vary:' header has something to do with this, but I never used it directly). Also, why…

> Also, why change the content type when one could just add some query string parameters?

For the same reason you use HTTP verbs. It conveys more information within the standard. Software in the middle may act upon it. A cache is a perfect example. Imagine the cache sees a request accepting json or xml. The server chooses to return json. A second request accepts only json. The cache knows, from the standard, that the first response is valid for the second request.

Not that you can't configure something like Varnish to reproduce this behavior with query params, but with the standard oriented approach you get the correct caching behavior out of the box.

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#133

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

  REST is one of the worst tech religions
  ever created yielding the most blinkered
  zealots... Any alternative technology ...
  is considered an evil intrusion invalidating
  the purity of REST and must be vanquished.
What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon.

  No we must develop and shoe-horn all
  App and User experiences within the
  constraints of an ambiguous thesis that
  was built to link and update documents
  and create server-driven turn-by-turn
  apps.
Wow. Pretty harsh, considering that the author of said "ambiguous thesis" is also one of the handful of people responsible for defining the very infrastructure which makes your diatribe possible to disseminate. Along with some guys named Tim[1] and Henrik[2].

Perhaps, instead of using this "shoe-horn-mandatin', ambiguous thesis thinkin', can't-force-their-ideas-on-everyone" HTTP "religion", you'd prefer whatever Facebook tells you is better?

Oh, and ya might want to do that with something that doesn't use HTTP.

Coz if you did, then u r p0wned by teh man.

1 - http://www.w3.org/People/Berners-Lee/

2 - http://www.ietf.org/rfc/rfc1945.txt

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#134
post #45

I deal with REST zealots like this everyday :( just the fact that people spend so much time debating what is and what isn't REST should be a red flag that maybe it isn't the answer to everything. All the simple REST examples make it look like it is the perfect solution for CRUD tasks. But in reality API endpoints are not a straight pass through to the database. An endpoint may do any combination of CRUD tasks, it can…

HATEOAS

I love the idea of HATEOAS, but in the end, I've never found I cared enough to jump through the hoops of using it (ie it didn't offer enough value for the work it would take), which in turn meant that the effort of implementing it on the server seemed too expensive too.

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#135
post #68
post #45

I deal with REST zealots like this everyday :( just the fact that people spend so much time debating what is and what isn't REST should be a red flag that maybe it isn't the answer to everything. All the simple REST examples make it look like it is the perfect solution for CRUD tasks. But in reality API endpoints are not a straight pass through to the database. An endpoint may do any combination of CRUD tasks, it can…

> Overloading HTTP error codes is another interesting problem. If the server returns 404 for a resource, what actually happened? I, the dude who made the API, sent you a 404. I sent you a 404 because that's all I wanted you to know. What actually happened is none of your business. If I wanted you to know, I would have sent a 400 with an explanation attached. But I didn't. Because in this particular case, it was none…

> Or are they baking something that is uniquely suited to their own needs?

And? If it is also suited to my needs, what's wrong with that?

The existence of Relay and GraphQL doesn't mean that you (the developer of some API) have to use it.

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#136

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

REST is one of the worst tech religions ever created yielding the most blinkered zealots... Any alternative technology ... is considered an evil intrusion invalidating the purity of REST and must be vanquished. What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon. No we must develop and shoe-horn all App and User experiences within the constraints of an ambiguous thesis that was built t…

[deleted]

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#137

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

REST is one of the worst tech religions ever created yielding the most blinkered zealots... Any alternative technology ... is considered an evil intrusion invalidating the purity of REST and must be vanquished. What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon. No we must develop and shoe-horn all App and User experiences within the constraints of an ambiguous thesis that was built t…

[deleted]

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#138

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

REST is one of the worst tech religions ever created yielding the most blinkered zealots... Any alternative technology ... is considered an evil intrusion invalidating the purity of REST and must be vanquished. What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon. No we must develop and shoe-horn all App and User experiences within the constraints of an ambiguous thesis that was built t…

[deleted]

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#139

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

REST is one of the worst tech religions ever created yielding the most blinkered zealots... Any alternative technology ... is considered an evil intrusion invalidating the purity of REST and must be vanquished. What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon. No we must develop and shoe-horn all App and User experiences within the constraints of an ambiguous thesis that was built t…

[deleted]

Re: Facebook Relay: An Evil And/Or Incompetent Attack on REST

#140

REST is one of the worst tech religions ever created yielding the most blinkered zealots. It's treated like a Bible where every word is taken as the Gospel truth that can't be tested, validated, compared or improved upon. Any alternative technology that reduces latency, improves performance and end user experience is considered an evil intrusion invalidating the purity of REST and must be vanquished. In the name of R…

REST is one of the worst tech religions ever created yielding the most blinkered zealots... Any alternative technology ... is considered an evil intrusion invalidating the purity of REST and must be vanquished. What a reasoned, sound, rational discourse. Good thing zealotry should be shat upon. No we must develop and shoe-horn all App and User experiences within the constraints of an ambiguous thesis that was built t…

> Wow. Pretty harsh, considering that the author of said "ambiguous thesis" is also one of the handful of people responsible for defining the very infrastructure which makes your diatribe possible to disseminate.

Actually no, TCP/IP/DNS is the backbone of the Internet and what made the Internet possible, HTTP was invented before Roy dropped his thesis. People like to give Roy kudos for inventing the Internet which re-inforces the "Bible" concept REST-afarins like to re-enforce as their blindly ignoring any other superior technology that's not deeply rooted in a REST philosophy.

Here's a quote from Alan Kay on the Internet as it was invented in 1969 - which handle billions of nodes that has never been stopped after it was turned on and had all its atoms replaced:

> The Internet was done so well that most people think of it as a natural resource like the Pacific Ocean, rather than something that was man-made. When was the last time a technology with a scale like that was so error-free?

Take note the lack of any mention of REST. This is what he has to say about the tacked on "Web" you're attributing to the Internet:

> The Web, in comparison, is a joke. The Web was done by amateurs.

The thing that makes the Internet possible is its infrastructure, the thing that makes the web platform powerful is modern web browsers - i.e. the things that only the largest tech companies spending decades of developer effort and investing 100's of millions can do to maintain a competitive browser. Which Despite its primary focus and decade-long head-start it's still getting eaten by Native Mobile Apps and not because they better at adhering to the constraints of REST, quite contraire, they're not grounded into the turn-by-turn per-request model and just focus on providing the best end-user experience they can using the most suitable technology for each task.

HTTP is a conduit sitting in the middle, adding unnecessary overhead on each request that's great for linking documents and composing static content sites but is poorly optimized for Responsive or Interactive Web Apps.

> you'd prefer whatever Facebook tells you is better?

No people should learn to think for themselves and use their experience to pick the best tool for the job, not blindly follow mindless preachers who can only think in REST ignoring anything superior that can deliver end-users a better experience - i.e. who Technology should be serving, not the other way round.

Post reply on HN