4 ms·
A nice article, the key ideas can be scooped by reading headlines. REST has its limitations, but it has one nice advantage: it uses a very well-understood, tot
by nine_k 11y ago
A nice article, the key ideas can be scooped by reading headlines.
REST has its limitations, but it has one nice advantage: it uses a very well-understood, totally ubiquitous, firewall-piercing protocol. I suppose it's still a huge win for any public-facing, moderate-load service. One can use compact (non-JSON) data representation and even compress headers to save bandwidth.
- dragonwriter 11y ago> REST has its limitations, but it has one nice advantage: it uses a very well-understood, totally ubiquitous, firewall-piercing protocol. REST is a protocol-independent architectural style. (And, even if you mean the kind of RPC over HTTP that is often misnamed REST, then using "a very well-understood, totally ubiquitous, firewall-piercing protocol" -- i.e., HTTP -- isn't really an advantage over the main things it is an alternative to, e.g., XML-RPC and SOAP-over-HTTP, which use the same "very well-understood, totally ubiquitous, firewall-piercing protocol.")
- nine_k 11y agoYou are technically correct, best kind of correct! I'd love to see a relatively non-obscure example of REST run over to a non-HTTP protocol. REST feels sort of natural over HTTP, with all these URIs and HTTP method verbs. XMLRPC has all the disadvantages of REST listed in the original article, but seemingly none of the advantages (like a logical, discoverable structure). Correct me if I'm wrong. SOAP indeed has advantages — it has WSDL! When done correctly, it's delightful to work with. It's complicated and enormously more bloated, though. When run over HTTP (that is, most of the time), SOAP suffers from the same transport- and connection-related disadvantages as REST over HTTP does.
- dragonwriter 11y ago> I'd love to see a relatively non-obscure example of REST run over to a non-HTTP protocol. HTTP itself is the prototypical example; it is REST over an unspecified lower-level transport protocol (usually, in practice, TCP/IP, but that's explicitly not required in the spec) in the same sense that REST APIs that we usually talk about are typically REST over HTTP.
- slantyyz 11y agoI found this headline odd: "Bloated, human readable format that demands extra compression" Is human readability a main reason for using JSON or is it a beneficial side effect? I always assumed (rightly? wrongly?) that the reason for using JSON was that it uses Javascript's native object format and therefore much easier to serialize/deserialize and debug at the browser level.
- strictnein 11y agoAnd it makes absolutely no sense when comparing it to the most popular alternative: XML. Talk about bloated.
- nine_k 11y agoHuman-readability means low density: ASCII only uses 7 bit of 8, and most characters, like letters or digits, use only 6. Nobody in their sane mind would `eval()` a JSON received from network, so parsing is required in any case, JS or not. A combination of lists and maps (maps being just a special-form list of pairs) can be represented in a much more compact way, especially numbers. Thrift and Cap'n Proto are definitely more compact and as fast, or faster, to parse. I still suspect that in many cases, HTTP headers can be comparable to the message in size. A high-efficiency protocol would create a connection and avoid re-sending this information with every request — but good luck taking it through certain corporate firewalls.