{"id":171,"date":"2008-10-13T07:00:13","date_gmt":"2008-10-13T15:00:13","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=171"},"modified":"2009-07-11T04:07:56","modified_gmt":"2009-07-11T04:07:56","slug":"rest-versus-rpc","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/rest-versus-rpc\/","title":{"rendered":"REST versus RPC"},"content":{"rendered":"<p>Have you considered the merits and applicability of RESTful web apps? Here are a few notes I&#8217;ve made.<\/p>\n<p>There was quite a [discussion about RPC, REST, and message queuing](http:\/\/steve.vinoski.net\/blog\/2008\/07\/13\/protocol-buffers-leaky-rpc) &#8212; they are not the same thing. Each one is needed in a different scenario. All are used in building distributed systems.<\/p>\n<p>Wikipedia&#8217;s [explanation of REST](http:\/\/en.wikipedia.org\/wiki\/Representational_State_Transfer) is quite informative, especially their [examples](http:\/\/en.wikipedia.org\/wiki\/Representational_State_Transfer#Example) of RPC versus REST.<\/p>\n<p>The poster &#8220;soabloke&#8221; says RPC &#8220;Promotes tightly coupled systems which are difficult to<br \/>\nscale and maintain. Other abstractions have been more successful in building<br \/>\ndistributed systems. One such abstraction is message queueing where systems<br \/>\ncommunicate with each other by passing messages through a distributed queue.<br \/>\nREST is another completely different abstraction based around the concept of a<br \/>\n&#8216;Resource&#8217;. Message queuing can be used to simulate RPC-type calls<br \/>\n(request\/reply) and REST might commonly use a request\/reply protocol (HTTP) but<br \/>\nthey are fundamentally different from RPC as most people conceive it. &#8221;<\/p>\n<p>The [REST FAQ](http:\/\/rest.blueoxen.net\/cgi-bin\/wiki.pl?RestFaq) says, &#8220;Most applications that self-identify as using &#8220;RPC&#8221; do not conform to the REST. In particular,<br \/>\nmost use a single URL to represent the end-point (dispatch point) instead of using a multitude of<br \/>\nURLs representing every interesting data object. Then they hide their data objects behind method<br \/>\ncalls and parameters, making them unavailable to applications built of the Web. REST-based<br \/>\nservices give addresses to every useful data object and use the resources themselves as the<br \/>\ntargets for method calls (typically using HTTP methods)&#8230; REST is incompatible with<br \/>\n&#8216;end-point&#8217; RPC. Either you address data objects (REST) or you don&#8217;t.&#8221;<\/p>\n<p>RPC: Remote Procedure Call assumes that people agree on what kinds of procedures they would like<br \/>\nto do. RPC is about algorithms, code, etc. that operate on data, rather than about the data<br \/>\nitself. Usually fast. Usually binary encoded. Okay for software designed and consumed by a<br \/>\nsingle vendor.<\/p>\n<p>REST: All data is addressed using URLs, and is encoded using a standard MIME type. Data that is<br \/>\nmade up of other data would simply have URLs pointing to the other data. Assumes that people<br \/>\nwon&#8217;t agree on what they want to do with data, so they let people get the data, and act on it<br \/>\nindependently, without agreeing on procedures.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you considered the merits and applicability of RESTful web apps? Here are a few notes I&#8217;ve made. There was quite a [discussion about RPC, REST, and message queuing](http:\/\/steve.vinoski.net\/blog\/2008\/07\/13\/protocol-buffers-leaky-rpc) &#8212; they are not the same thing. Each one is needed in a different scenario. All are used in building distributed systems. Wikipedia&#8217;s [explanation of REST](http:\/\/en.wikipedia.org\/wiki\/Representational_State_Transfer) &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/rest-versus-rpc\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;REST versus RPC&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,16,17,19],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","hentry","category-programming","category-security","category-tech","category-work"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":6,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":175,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/171\/revisions\/175"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}