
Facebook Relay: An Evil And/Or Incompetent Attack on REST - mwcampbell
https://www.pandastrike.com/posts/20151015-rest-vs-relay
======
pixie_
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't be
type casted as a single one with a HTTP verb.

Overloading HTTP error codes is another interesting problem. If the server
returns 404 for a resource, what actually happened? Did the web server or my
application return the 404. Conflating HTTP and application error codes leads
to confusion.

HATEOAS is just superfluous. I've met zealots who will defend it to the death.
I just haven't found a practical use for it.

Surface area and complexity are a big deal. REST encourages creating a CRUD
interface for every single resource. I've met people who have created
literally 100 endpoints upfront for a small application - how is that
maintainable?

I like that Facebook is standing up to the zealots. I get attacked at work
when I try to create simple API endpoints and they aren't 100% REST (if anyone
could agree what that even is.)

~~~
sbov
I agree with pretty much all of this.

We developed an API because we had desktop/mobile/website. They all use the
same API. I call it REST-ish.

I can't see how people think returning 404 for a "this product doesn't exist"
is defensible. You now have two different things intertwined: this product
doesn't exist (generally not a huge deal - what if an end user manually edits
the url on your storefront?), and this url makes no sense (a huge deal -
something is _broken_ ).

If you had code that threw the same exception when a product didn't exist vs
when the table in your database doesn't even exist you would be ostracized. I
don't see how it's somehow OK because it's REST.

~~~
harryf
> I can't see how people think returning 404 for a "this product doesn't
> exist" is defensible.

To tell Google for example to stop sending traffic to this URL because it's
gone.

~~~
sbov
Is this a thing? Having Google index your REST api?

------
jtchang
This article is a load of bullshit. When Facebook announced Relay it made
immediate sense to me. The problem of fetching the right data from the backend
is a pain in the ass for anyone that has built more than a simple todo app.

To me it is like sending a SQL query to the backend and instead of getting
rows back you get objects nested in a way you specify.

The problem when using REST "correctly" is that the way your objects
interrelate is not necessarily the same way on the backend as it is on the UI.
So you end up creating custom REST endpoints for complicated UI that does not
map directly to how your objects are related in the database.

This article has no substance in how they want to solve it besides just
spouting "use REST correctly".

~~~
danpalmer
Actually, they mention using content type negotiation for versioning, content
types as a type system, HTTP caching for speed and reducing the number of
requests, and lots more solutions.

The article actually makes some well reasoned points, and I think poses a very
good challenge to what Facebook are doing.

~~~
glifchits
I don't think Facebook ever claimed that HTTP was insufficient. They claim
that HTTP/REST does not scale in large and dynamic projects, and Relay/GraphQL
solves some of those scaling concerns. Given how strongly Relay/GraphQL is
resonating with developers, I would tend to agree that the raw HTTP way of
solving these things (as you note above) are not good enough for the needs of
most projects.

~~~
danpalmer
> They claim that HTTP/REST does not scale in large and dynamic projects

This is my point, the blog post has a good HTTP/REST based answer for all or
most of the criticisms Facebook has of it, which I think poses a challenge to
Facebook.

> Given how strongly Relay/GraphQL is resonating with developers

I'm inclined to avoid appeal to the majority, after all, PHP is very popular.

~~~
glifchits
I think the appeal to majority goes the other way in this case. The article
insists that existing technologies which dominate usage today (ie. HTTP) are
good enough, and that Facebook's innovations are misguided. The authors have
previously made similar claims about the DOM (vs. React). And after all, HTTP
comprises of a far greater majority of server architectures than Relay/GraphQL
does at the moment.

------
bsimpson
I have a problem taking seriously any article that spreads FUD by accusing
their targets of spreading FUD.

The people who build React and the related ecosystem are incredibly smart
people trying to make the web better. I'm certain there's no ill-intent in
their motives. Regardless, they open source pretty aggressively. If an open
technology from Facebook displaces another open technology from another
source, I don't understand why we should be upset simply because the backer of
the more popular technique was Facebook.

~~~
Mikushi
The web has been getting worst every year, mostly due to these companies
spreading technologies to fix a web that is "broken" but who nobody but
themselves complained about.

I agree wholeheartedly with OP, Facebook & cie might have problems with
certain components of the web, but they are neither broken or in need of a
fix, that it doesn't fit their need sure, but their needs are, well, theirs.

I can count on one hand the number of tech that came out in the past 5 or 6
years that are actually an improvement on the old if you are not Google or
Facebook.

What OP should have said may be is, stop trying to pass your problems as
everyones problems. 99.9% of the web can function with the way the web was 5
years ago, if not more. Hell I was operating at high scale using standard
stacks 7 years ago and I don't see why or how the situation has changed at all
to warrant any of the bullshit technologies that are constantly touted as a
fix.

Developing for the web has become more of a nightmare than anything else
because of the likes of Twitter, Facebook or Google pushing their stack on
people who never needed it.

~~~
TazeTSchnitzel
Are Facebook actually passing their own problems as everyone's? They're making
technologies which suit their needs better, and other people can use them too,
but they're not forcing them on anyone.

------
dkersten
I've spent many months over the past few years trying to really understand
REST in order to design a good API and it never quite sat right - there was
always something that seemed like a hack.

I'm not going to pick through the OP post, except this line:

 _" a REST endpoint can return whatever you want"_

Yep. I know this and have done that: an endpoint to return complex data. And
it never felt right - either I make a bunch of special endpoints losing all of
the nice consistency of REST, or I have endpoints that return too much or too
little. Or I have a highly parameterized endpoint that essentially lets me
pass it a query ( _cough_ like GraphQL!)

At the start of the year, I was thinking about how I would like to write my
applications client and what I (conceptually, I never got to implement it)
came up with was rather similar in concept to Relay/GraphQL in that UI
components declaratively state what data they are interested in and the system
keeps it in sync by querying the server similar to how Relay/GraphQL do.

I personally find that model much nicer than REST.

But... as a consumer of third-party API's, I do love REST and worry about what
a shift might do. However, from a SPA application development point of view, I
love the concepts behind Relay and GraphQL more than REST.

But hey - I guess I just don't understand REST well enough (actually, I really
don't - I'd be the first to admit it!), despite spending a long conscious
effort in trying to. Which is the problem: this mythical "proper" REST seems
too difficult to understand and use, so everyone kinda just makes up their own
flawed flavour and calls it REST.

~~~
keithwhor
"REST" as we've come to know it is just a useful design pattern for APIs.
That's it. It's not a law. You probably don't lack understanding of REST,
every developer just has their own interpretation of edge cases (multi-
resource responses, etc.) and different experience with what's worked and what
hasn't.

I wouldn't get caught up in the details. Use whatever tool is appropriate to
solve your problem(s). I think it's likely we'll find certain design patterns
(GraphQL vs. REST) are best suited to projects with specific problem spaces or
scope. Maybe it's always best to start out "RESTful" and begin migrating to a
different interface as your app scales in complexity. Maybe the latter problem
is only an issue with medium or larger projects. Perhaps it's best to teach
developers to be strict with REST to develop good habits and start migrating
away once they're confident and comfortable with their ability to make
architectural decisions.

Either way --- don't sweat it. Experiment with what _you like_ because you're
the creator. Figure out what works best for you, and you'll be able to
identify wins and challenges and decide for yourself how to use the
technologies around you and what they bring to the table.

------
dustingetz
Here's a quote which I think well describes Facebook's stance on REST, before
GraphQL and Relay were public. This is the idea that motivated GraphQL and
Relay.

 _" REST does a shitty job of efficiently expressing relational data. ... I
mean REST has its place. For example, it has very predictable performance and
well-known cache characteristics. The problem is when you want to fetch data
in repeated rounds, or when you want to fetch data that isn't expressed well
as a hierarchy (think a graph with cycles -- not uncommon). That's where it
breaks down. I think you can get pretty far with batched REST, but I'd like to
see some way to query graphs in an easier way."_

\-- Pete Hunt in 2013, when he worked at Facebook on React:
[https://news.ycombinator.com/item?id=7600565](https://news.ycombinator.com/item?id=7600565)

~~~
eggie
A query on a graph or a tree can both be RESTful. You can describe traversals
of the graph or tree in a query embedded in an HTTP endpoint. You don't need
to make repeated round trip queries to do the traversal unless you are
unwilling to use a suitable query description.

Metaphorically this is all pretty funny becuase the web is already a graph at
a fundamental level.

~~~
dustingetz
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 misread, but "You can describe traversals of the
graph or tree in a query embedded in an HTTP endpoint" \- this is basically
what GraphQL/Relay is: an easy way to do arbitrarily nested or recursive
queries, like those you find in real complex applications.

(Plug: I am a React consultant, hire me!)

~~~
eggie
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 biased to disillusion my confusion.

~~~
tiglionabbit
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)

------
bjt
I have a near-immediate distrust of anyone who says "you're all doing REST
wrong." I've built my share of REST APIs. I've seen firsthand the tradeoff
they face as more use cases are added, between letting the payload size keep
creep upwards or exploding the number of endpoints. I like what GraphQL is
doing to fix that.

On the other hand I've never seen an API in the wild that I felt would really
satisfy a REST purist. In theory, it'd be great to be able to stick a dumb
HTTP cache in front of your app and have that solve all your performance and
scalability problems. In practice, you have to sacrifice too much.

------
thomasahle
> a REST endpoint can return whatever you want. If you only want a subset of
> that graph, make an endpoint around that subset.

So we have to make endpoints around every possible subset?

> You want to avoid large object graphs anyway, for two reasons. Returning
> coarse-gained chunks of data tends to work against effective caching
> strategies, whether you're using REST, Relay, or anything else. You have to
> cache the whole chunk or nothing.

I thought the whole point of Relay et al. was that it would cache the union of
the chunks, such that when I request more data, it can download only the exact
pieces I need?

~~~
jerf
"So we have to make endpoints around every possible subset?"

No, you use the _query_ in querystring. One way or another you're offering a
query interface. A lot of REST is just about how you offer the same interfaces
you were planning on offering anyhow. Which is probably a source of a lot of
the frustration REST advocates experience. If you're genuinely doing something
that REST can't do very well, OK then, but if you're doing something that HTTP
can already do, why layer something else on top of HTTP that HTTP is already
doing?

(Sometimes there are good answers to that question, though.)

~~~
thomasahle
> No, you use the query in querystring.

Ok, but doing that straight on top of HTTP, will only cache queries that are
exactly equal to previous ones. Not queries that are a subset of previous
queries.

~~~
jerf
I think you have to be careful not to be too cavalier with the word "cache"
there. While REST is sort of vaguely concerned with the ability to cache in
the general sense, in real life we have to be specific about what is doing the
caching. This is the sort of dynamic query you'd normally tell intervening
proxies not to cache anyhow, so now we can reduce our concerns to the client
and the server specifically. On the client, if it asked for a big chunk of the
graph and now need to operate on a smaller on, I'd suggest that if the client
does not want to incur another round trip, it would be incumbent on the client
not to ask another question. (This is further backed up by a consistency
concern; if I ask again, I may get a different answer because it has actually
changed in the meantime. You may be better off with your code not even looking
at the changes.) On the server, caching technologies can easily be arranged
(if the server cares) to cache more granularly than is necessarily reflected
in the answers. (In fact _most_ of my "cloud" caches I'm currently responsible
for do that all the time.)

I actually don't deny there's a use case here necessarily, but it may not be
all that large, even to Facebook.

~~~
thomasahle
I was thinking of a large graph, where everybody wanted different parts. Then
a cache somewhere in the middle could work, even if nobody wanted exactly the
same parts.

However I guess you could achieve the same by sending many parallel requests.

------
alexmuro
Jafar Husain does an excellent job of explaining some of the problems netflix
has had with REST APIs and why you might want to take a different approach in
his introduction to Falcor video. Falcor is tackling some of the same problems
as graphql / relay but making trade offs at different points.

[https://netflix.github.io/falcor/starter/why-
falcor.html](https://netflix.github.io/falcor/starter/why-falcor.html)

A REST API may be the best decision for a lot of projects but GraphQL and
Falcor are solving interesting problems that come up more and more in single
page apps of increasing complexity.

~~~
Mickydtron
It's interesting to read the article with his presentation in mind. From a
technical perspective, you should be able to just swap Netflix/Falcor in for
Facebook/Relay in this article and have the arguments make about as much sense
(They are both graphQL adjacent approaches to APIs that explicitly abandon
RESTful principles). However, it seems to me that the article would be way
less persuasive or interesting if you did that, because a lot of the intended
force of the article relies on the premise "Facebook is evil", rather than the
technology at hand. However, using "Facebook is evil" to prove "This thing
that Facebook is doing is evil" is way less interesting than showing the
latter just from technical details.

------
empath75
I'm not an expert on REST by any means, but it seems like that guy is sort of
intentionally misrepresenting what they're doing. They didn't say Rest isn't
good. They said that Rest isn't good for what they're doing with it. If you
don't like it, don't use it.

------
michaelbuckbee
An interesting comparison might be to something like sending protocol buffers
over the wire instead of JSON [1].

You can make a 100% valid and spirited defense of JSON (human readable! lots
of open source tooling!) which at Facebook's scale is trumped by "well it
works 20% faster and we have 400 million users that will see the benefit".

And that scale aspect of this really matters. OP is completely correct in the
criticisms that X_NEW_THING can be done in REST, but with the number of users
+ infrastructure that Facebook is dealing with, small improvements can really
matter.

1 - [https://code.facebook.com/posts/872547912839369/improving-
fa...](https://code.facebook.com/posts/872547912839369/improving-facebook-s-
performance-on-android-with-flatbuffers/)

------
imjared
fwiw, pandastrike seems to be on a crusade against all things Facebook/React
so take this with a grain of salt.
[https://twitter.com/vjeux/status/655128064754499588](https://twitter.com/vjeux/status/655128064754499588)

~~~
jraines
It's all in the game:
[https://gettingreal.37signals.com/ch02_Have_an_Enemy.php](https://gettingreal.37signals.com/ch02_Have_an_Enemy.php)

------
drcode
If you loved this post, I highly recommend this book!
[http://i.imgur.com/n4ogzt4.png](http://i.imgur.com/n4ogzt4.png)

------
stupidcar
By the time I finished this article, I hated the authors' superior, paranoid,
whining tone so much I found myself hoping Facebook does destroy the open web
just because it would annoy them.

------
mecameron
Two biggest issues: 1\. This just reeks of "No true Scotsman". My biggest
issue with this REST purist rhetoric is that it seems no one can actually
implement REST, but apparently if someone could it would solve most/all of our
problems. But after many years of smart people unable to implement REST
properly according to these critics, then maybe the problem is with REST.

2\. "If you implement REST, you use content negotiation, and thereby eliminate
versioning and typing issues"

The author is conflating the issue of identifying a client version and
actually responding with appropriate client specific version data. It's one
thing to identify which version via some mechanism (e.g. URL, query string,
content type), but you still need the latest code to handle all of the
versions you want to support. The author seems to believe that that using
content type will solve both problems, whereas the real problem is actually
having an implementation that responds with the right client specific data and
not break between releases.

------
neilellis
I have to agree with this article. There is a tendency in tech to reinvent
what we don't understand properly, and from experience of using third-party
APIs (and from my own ignorance too) - HTTP is the thing we seem to know the
least about (well actually one could argue TCP/IP is ...)

I read this article from top to bottom and I didn't feel the comments were
extreme or purist. It did leave me thinking we need to spend more time
learning and sharing knowledge of HTTP /REST than dismissing it.

Of course, the headline is clickbait - and that is the only real criticism I
had.

~~~
eropple
We could assume that, yes, everybody, Facebook included, just doesn't know
REST (and implicitly assume that REST is an inherent good in the process). Or
one could go "you know, Facebook has a lot of insanely smart people and their
engineers are on record as having had problems with REST around stuff like
complex object graphs and cycles, so maybe their solution is worth looking
at."

If you have to say "oh, this thing is universally great, you all just don't
understand it," I will bet hard against you at the first opportunity and I'll
usually win in the process.

~~~
neilellis
A large group of smart people often produce some really dumb ideas, like
'Google Wave' \- so I wouldn't personally use 'Proof by Large Group of Smart
People' in this case. Hacker News has been the home of many a bad idea by
smart folk.

Instead, maybe we should all be critiquing the points raised.

In my limited experience, most engineers (yes including very smart ones) are
more enamoured with their own ideas (and not discounting myself here!) than
learning other people's work well. And the critique I read didn't seem unfair
in that respect, more so it encouraged me to look deeper at HTTP first before
I add something into my apps own protocols. Which to me is a good thing.

Especially around content negotiation which I had not looked at beyond a
superficial understanding.

For the record I ain't no purist :-)

~~~
s73v3r
Right, but if your argument is that they just didn't understand REST, and yet
they employ some of the smartest people around, so if they can't understand
REST, what chance do the rest of us have?

------
hencq
It's a shame that this article spends most of its time ranting and throwing
around irrelevant attacks at Facebook (we get it, you don't like their
product). If I buy the author's premise that REST does everything graphQL does
and that everyone is just using REST wrong, please show us how to properly do
it. Now I have to take the article's word for it, without any practical
explanation how to correctly design a REST API.

~~~
neilellis
I think there were some basic pointers in there, but yes I too would have
liked some examples on how to do things better.

As much as I dislike people critiquing from a purist point, I also dislike my
own ignorance on things that could keep my life simpler.

------
falcolas
Seems to me like the article and Relay are broken.

1) Why the new declarative query language for fetching attributes (columns)
from objects (tables)?

2) Why build yet another transport mechanism on the top of HTTP, when there
are so many to choose from already?

3) Oh, my god, boilerplate everywhere! What is this, Java?! /s

Seriously, though, the OP has some serious issues with Facebook, but to be
fair Relay stinks badly of NIH. They had great success with React (a love
letter to PHP), followed that with Flux (more of a design pattern than
anything else), but this third attempt seems like it's trying too hard to
create yet another data transport system.

~~~
drcode
> Why the new declarative query language for fetching attributes (columns)
> from objects (tables)?

SQL isn't very composable- It was the right idea, but there's been a lot of
progress in the last 50 years on how to traverse a database. It is all string-
based, and it lacks a "pull syntax" (i.e. after the query completes, give me
this graph-represented chunk of the result)

> Why build yet another transport mechanism on the top of HTTP, when there are
> so many to choose from already?

Relay is mostly agnostic on what mechanism is used to fetch results.

> Oh, my god, boilerplate everywhere! What is this, Java?! /s

Yeah, it's kind of awkward to do this stuff in Javascript- Look at what people
are doing in more flexible languages, like here
[https://github.com/omcljs/om/wiki/Quick-
Start-%28om.next%29](https://github.com/omcljs/om/wiki/Quick-
Start-%28om.next%29)

------
btown
There are very key points about GraphQL/Relay that the author of this post is
missing.

For a Facebook user, all client-side cached data is stale. All of it. Posts
are edited, profile pictures are changed (and those changes are referenced in
other posts that must appear to be consistent with the image shown to the
user). This is key to their value proposition - Facebook gives a new
experience each time the user comes back to the site, thus the user will check
the site multiple times a day. Now, you could cache if you could invalidate
the caches... and this is fine to do on the server side, but it's downright
impossible to push a client side cache invalidation at Facebook scale.

Another key insight is that "HTTP can fire network requests in parallel" is
insufficient if your requests are dependent on each other's results. Let's say
you want to crawl a graph of nodes. Are you going to do a BFS with a full HTTP
round trip at each level, collecting touched nodes and transmitting the border
each time? When the latency of that round-trip is at 2G speeds? How would you
handle this in REST, under the assumption (as above) that it's fine to let the
server handle caching?

Well, you might use the whole "HTTP's content types are a type system" concept
that the author loves, and annotate your REST request with the structure of
data you want back. UserWithPostsWithCommentsWithLikes is a type, after all,
just as UserWithProfileInformation is a type. And at that point you don't want
to name each of those separately; your Content-Type header would have some
structure; it would almost read like a programming language. Oh, and you
happen to have a server that can interpret that Content-Type piece by piece.
You would eventually realize it's just more sane to break that out into the
body of a POST request rather than holding on to REST just for REST's sake.
And then, boom, you have GraphQL.

The post devolves even further towards the end, making a dubious link between
Facebook's developer tooling and its grander ambitions. Making realtime graph
search, and realtime insights from the graph of entities, effortless to the
developer and the user... that's one way in which the web is evolving. Every
company needs to be able to think outside the box. If everyone took "don't
reinvent the wheel" completely literally, we wouldn't have airplanes.

Do I have gripes about the GraphQL syntax? Sure. Do I wish it was more like
JSON Schema? Does grokking Relay migrations feel like reading a James Joyce
novel? (With apologies.) Absolutely. But... are GraphQL/Relay a needed
proposal to push innovation on the web forward? Yes.

------
danpalmer
Does anyone know of really good REST APIs?

I feel like a lot of people talk about REST being better or worse than other
technologies, but I haven't seen a single 'perfect example' of a REST API. If
that's because it's impossible to make one, then that clearly tells us
something, but I can't see any reason why we couldn't make one, it just seems
that no one does.

By "really good", I mean something that includes HATEOAS, versioning, uses
content types correctly, utilises caching properly (probably HTTP 2 only with
server-push, but still), etc etc.

------
juandazapata
This article is implying that a group of the best engineers of the world
(Facebook and Netflix engineers came up with similar solutions with Relay and
Falcor), are just dumb and don't know how the web works.

There are motivations behind those solutions, and are documented across
videos, papers and documentation. It seems to me, that the author is ignoring
the previous experience of such teams.

------
programnature
tl;dr: lol.

The author is claiming Relay is a scheme to kill the open web. A simpler
theory is just that Relay solves a problem Facebook (and many other people it
seems) are having. The idea that REST has shortcomings for Facebook's use case
is an unthinkable thought for the author.

No argument is given for why we should consider REST to be a foundation of the
open web. REST != HTTP.

The post is full of logic-defying assertions like "Facebook wants to replace
REST with Relay for the same reason they want to replace DOM engines with
React Native."

------
wnevets
There seems to be a lot of attacking the messenger rather than the message in
these comments. Interesting.

~~~
grokys
I think because the tone of the article itself is so horrible. I honestly
couldn't read it.

------
TazeTSchnitzel
Facebook is not trying to kill REST. It just doesn't work well for their use-
case. So, they make their own system that suits them better.

What's wrong with that?

~~~
wmf
The point of the article is that Real REST _does_ work well for these use
cases (which is debatable, but that's what it says).

~~~
TazeTSchnitzel
That's what the author is trying to say, but it comes off as defensive. Sure,
REST probably can do these things, but by the sounds of things it's not ideal.

------
usaar333
Why is this upvoted so much? It's a complete strawman.

Facebook's own intro at
[https://facebook.github.io/react/blog/2015/05/01/graphql-
int...](https://facebook.github.io/react/blog/2015/05/01/graphql-
introduction.html) states:

"There is actually much debate about what exactly REST is and is not. We wish
to avoid such debates. We are interested in the typical attributes of systems
that self-identify as REST, rather than systems which are formally REST."

"We believe there are a number of weakness in typical REST systems"

The author of this article is talking about REST in general, while Facebook
specifically is talking about typical implementations of it.

~~~
Cakez0r
Read the whole article. The author addresses that exact quote.

------
gosukiwi
Sounds like the author spent a lot of time learning REST and is now mad at the
risk of learning something else and throwing REST through the window :p

------
wahsd
I find it rather problematic that this story moved from within the top 10
posts down to currently 78 in a matter of a couple of minutes. ..... Not that
anyone will see this now.

Facebook is an evil company headed by a psychopath that has said he wants to
replace at the very least what people perceive to be the internet. You are
killing the internet with every single thing you do on or with Facebook.

------
aikah
While I'm anti Relay/GraphQL/co , I see a problem right here :

> Blaming REST For The Non-RESTfulness Of Fake "REST"

As I said in another thread here, people don't get what REST is because the
original paper has done (IMHO) a poor job as explaining what it is
about,masking simple concepts behind complicated sentences (academia style).

Instead of being pedantic,arrogant and borderline insulting , which is
unnecessary to make a point, it would be simpler and more useful to say that
it is just about taking advantage of "natural" HTTP features and some web
concepts such as hyperlinks. So there is no such thing as "fake REST" if one's
intent is exactly that. Me not using content negotiation for API versioning
doesn't my API fake REST.

Too bad because the OP makes a few interesting points , but they are drown
into some hateful garbage.

~~~
bmn_
> the original paper has done (IMHO) a poor job as explaining what it is about

Please read
<[http://roy.gbiv.com/untangled/2008/specialization>](http://roy.gbiv.com/untangled/2008/specialization>).
The paper is for experts. Non-experts can learn from a suitable technology
book instead.

------
TheCoelacanth
Complete strawman. Facebook is quite clear that GraphQL is designed to address
weaknesses in REST as it is typically implemented, not weaknesses in the
actual concept of REST.

> We are interested in the typical attributes of systems that self-identify as
> REST, rather than systems which are formally REST.

------
bantunes
The Web and HTTP were designed as support systems for a set of hyper-linked
documents. Javascript came much later, and it's of little surprise to me that
devs are having a hard time figuring out how to make them work together. The
article is FUD, but some points are worth a read.

------
paultela
One of the main advantages of Relay/GraphQL is that it lets front end devs
iterate quickly without worrying about building new endpoints on the server
side. Less context switching is a win when building out new features quickly.

------
glifchits
These people have been attacking Facebook for a long time now. First React,
and now Relay/GraphQL. Their technical arguments were never strong. Claiming
that existing technologies eg. DOM, HTTP/REST are good enough is not
convincing (disclosure: I very much so buy Facebook's arguments).

But do they have a point in saying that Facebook is trying to control the web
stack? I believe that Facebook are working to make the web better as a whole,
but is this naïve? A better web for everyone helps big players like Facebook.
Hopefully one day Facebook doesn't slowly start to close off these huge OSS
projects.

------
intrasight
Author says "they made a series of claims about why REST is broken" \- without
making "claims" be a hyperlink to those original claims. So this whole piece
lacks semantic context and is therefore a fail.

~~~
bmn_
You are mistaken. Near the end there is a hyperlink to the claims document. It
is titled "Facebook's terrible post" and points to the URL
<[https://facebook.github.io/react/blog/2015/05/01/graphql-
int...](https://facebook.github.io/react/blog/2015/05/01/graphql-
introduction.html>).

------
forrestthewoods
Sometimes an API _can_ do something, but doesn't it make it easy. An
alternative that makes it easy isn't just a little valuable, it's a lot a
valuable.

This also applies to correctness. An API that _can_ do something may be a bit
of smashing a square peg through a round hole. An alternative that is round
peg through a round hole is much better.

I don't know enough to say what this situation looks like.

------
programminggeek
There are PLENTY of problems with REST. You would be a fool to think Facebook
is too stupid to understand why REST is perfect.

If I were FB, I'd only feel compelled to use REST for a public API. Otherwise,
I'd use the best tool for the job.

------
carsongross
How did this article get flag killed?

I wanted to say something constructive about the topic: Any time you layer an
arbitrary UX over a given data model, expressiveness is absolutely necessary
in the protocol in order to minimize round trips. This is why SQL has been so
successful on the server side.

An alternative to the "moving the whole graph to the client side" approach is
the intercooler.js way
[[http://intercoolerjs.org/](http://intercoolerjs.org/)]: HTTP requests
express _UI /UX_ needs, rather than generalized data queries to support a
client-side object graph and model.

This eliminates a whole swath of complex issues that come up with managing
multiple instances of data in a distributed object graph environment, knocking
system complexity down an order of magnitude.

~~~
LukeB_UK
You should probably mention that you're the main contributor to
intercooler.js. I've noticed quite a few comments from you plugging
intercooler.js but with no mention of the fact that it's your project.

~~~
carsongross
Sure: I am the main contributor to intercooler.js, I use it every day in
production and, when it is relevant to a given article, I mention it.

------
philjackson
The tone of that article doesn't make me want to join their team...

------
catshirt
in 6 years here this is the first post i felt compelled to comment on without
even reading the article. the comments here reinforce my decision...

if you have read the GraphQL docs, and built a sufficiently complex REST API,
there is literally, technically speaking, no way to support this claim.

still i skimmed the article... it must be satire.

------
mvdanj
Interesting how this article was #1 on HN a few hours ago and mysteriously
disappeared.

Conspiracy?

~~~
carsongross
Flag killed.

The unanimity of the commentary on the article (which was ranty, but had some
reasonable points to make) is disturbing as well. No one is willing to take
the other side of the argument?

~~~
bmn_
There was apparently only a 30 minute window to do so. HN moves too fast for
nuanced counter-replies to the commentary. If I just made a top-level comment,
it would say something along "I agree in broad strokes", which is not that
useful.

~~~
carsongross
And, from the looks of it, you would have been downvoted into oblivion for
your trouble.

So there was a zerg rush of negative ad hominem on the article and then it was
flag killed despite being a reasonable technical topic to discuss. Good times,
good times.

------
yablak
Can someone explain to me how Relay compares to gRPC?

------
devtique
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 REST, practitioners give themselves a free-ticket to develop
large, over-architected, dumb chatty high-latency solutions at the expense of
the end user as long as tech choices are made within their interpretation of
REST. Normally technology serves the client, unless you're a REST zealot in
which case what the needs of the client is secondary, its more important to
obtain Internet kudos points by forcing your way up the maturity ladder.

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. The fact they can't correctly
interpret what different parts of REST means amongst themselves have generated
programmer-decades worth of wasted discussions in the most useless bikeshed
ever.

~~~
AdieuToLogic

      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/](http://www.w3.org/People/Berners-
Lee/)

2 - [http://www.ietf.org/rfc/rfc1945.txt](http://www.ietf.org/rfc/rfc1945.txt)

~~~
devtique
> 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.

~~~
AdieuToLogic

      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 ...
    

Hi strawman[1], nice to see you again. I specifically stated that Fielding,
Berners-Lee, and Frystyk were responsible for defining _HTTP_. A fact well
documented by the aforementioned RFC-1945 reference. Since your reply was
submitted by some form of _HTTP client_ (a.k.a. "web browser"), by definition
it used said protocol or the derivative "HTTPS" protocol to do so.

This is further supported by you acknowledging the same:

    
    
      ... the thing that makes the web platform
      powerful is modern web browsers ...
    

You see, these "modern web browsers" support a thing called "HTTP." And this
"HTTP" thingie was defined by a handful of people (this sounds familiar).

Regarding web client performance verses native apps, you state:

    
    
      Which Despite its primary focus and
      decade-long head-start it's still getting
      eaten by Native Mobile Apps ...
    

This largely can be explained by bloated JavaScript-based SPA's[2] downloading
_megabytes_ of interpreted code. Want faster performing interaction? Don't
stuff dozens of script references into a page which mandates the system to
download them before being useful.

How could this be done? One is called Code-on-Demand[3]. But for this to be
viable, the system must recognize the server as being a first-class concern
which collaborates with its clients instead of being a glorified data base
connection pool. But if a person is myopically focused on what executes
_solely in the browser_ , this might elude them.

    
    
      >  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 ...
    

Here's a point we agree upon. Nice to end it on a high note.

1 -
[http://www.asa3.org/ASA/education/think/strawman.htm](http://www.asa3.org/ASA/education/think/strawman.htm)

2 - [https://en.wikipedia.org/wiki/Single-
page_application](https://en.wikipedia.org/wiki/Single-page_application)

3 -
[http://restcookbook.com/Basics/codeondemand/](http://restcookbook.com/Basics/codeondemand/)

