125 points · by velmu · 11y ago · 27 comments
EDIT: Or let's go full AMF again and use classes and objects defined on the server in the client... I fail to understand how Falcor and GraphQL are a better alternative to what already exists. Why limit it to queries then ? let me get my FactoryFactories right back in the client instead of yet another format, since REST is basically thrown out of the window anyway.
You are also bound to use both their client-side AND server-side libraries which locks you completely in.
1. Under fetching and over fetching.
2. REST is great for CRUD, but not everything is that simplistic. Eg: Changes spanning multiple entities with transaction support.
3. Patchy PATCH support. Also, endless debates on whether something should be a PATCH or a PUT or a POST. The answer in some of those cases was that it couldn't be solved with clean REST.
(Edit: added GraphQL)
An often overlooked technique for handling such arguments is to quit bickering and get back to work solving the business problems.
Maybe it's slightly harder to implement those things in REST, but REST gives you HTTP caching and that's a killer feature. If you'd prefer to re-invent caching so you can use POST everywhere be my guest.
I'm genuinely curious because as a web developer most of the problems I have encountered can be solved with API versioning, filters, paginations, scopes (limiting returned fields) and hierarchical URL structures (e.g: /users/:userId/comments/:commentId).
Also remember that having a resource oriented design and working well with HTTP gives you out of the box advantages in terms of caching and validation, and in HTTP/2 you get extra efficiency advantages (e.g. lots of more granular resources can be retrieved over a single connection).
2. There are patterns for that though, often best approach is to represent that transaction as a resource. Restful Web Services Cookbook covers approaches for these sorts of bulk operations.
3. Not sure that's an argument against going resource oriented, if you don't find the debate interesting just ignore it.
As for the lock in, working in this paradigm would be impossible without a smart client library. Similarly, GraphQL has Relay. But Falcor's client side library is much more flexible than Relay, which is only a wrapper around React apps. If you have a non-React project, you have to use Falcor.
On the other hand, ASP.NET MVC or Web API will give you intellisense when consuming your endpoint.
The reason Asp.net MVC and Web API gives you type information is because a) you've already given type information b) tooling
You can overlay schema on Falcor API and verify it as part of the build. The tooling for the probably doesn't exist right now, but the building blocks for tooling do. Actually, your point is more about JS vs a statically typed language.