{"id":1193,"date":"2005-12-13T16:44:00","date_gmt":"2005-12-13T20:44:00","guid":{"rendered":"http:\/\/www.markbaker.ca\/wp\/2005\/12\/13\/sinks-sources-and-granularity\/"},"modified":"2005-12-13T16:44:00","modified_gmt":"2005-12-13T20:44:00","slug":"sinks-sources-and-granularity","status":"publish","type":"post","link":"http:\/\/www.markbaker.ca\/blog\/2005\/12\/sinks-sources-and-granularity\/","title":{"rendered":"Sinks, sources, and granularity"},"content":{"rendered":"<p>The topic of service granularity popped up a\n<a href=\"http:\/\/technoracle.blogspot.com\/2005\/11\/anti-patterns-for-soa-part-two.html\">couple<\/a> of\n<a href=\"http:\/\/www.redmonk.com\/jgovernor\/archives\/001079.html\">times<\/a>\na few weeks ago.  And though I&#8217;m a bit late to the discussion, I&#8217;d like to\ncontribute because I think there&#8217;s an important point here which is related\nto REST, as James anticipated, but didn&#8217;t expand upon &#8211; apparently he chose\nto play his analyst&#8217;s &#8220;Get out of real work&#8221; card 8-)<\/p>\n\n<p>I&#8217;ve often been heard to say that I think that large scale architectural\nstyles require interface constraints, but I&#8217;ve never, AFAIK, related that\nto granularity.  So here goes &#8230;<\/p>\n\n<p>In my\n<a href=\"http:\/\/www.markbaker.ca\/2005\/11\/ServiceOrientedWeb\/\">Service Oriented Web<\/a>\npresentation from, I used the generalization argument to describe the uniform interface;<\/p>\n\n<pre>\ngetRealTimeStockQuote: not uniform ...\ngetStockQuote: not uniform ...\ngetQuote: not uniform ...\nGET: uniform\n<\/pre>\n\n<p>Web services &amp; SOA currently offer no guidance for &#8211; aka, provide no constraints upon &#8211;\noperation semantics; all of the above are A-OK, and no one should be preferred\nover the others.  On the other hand, REST says only the last one &#8211; GET &#8211;\nis viable because of its extreme generality.<\/p>\n\n<p>But what does this have to do with granularity?<\/p>\n\n<p>Well, if you&#8217;ve got a single service with, say, three API calls (also taken from the\nSOW presentation, <a href=\"http:\/\/www.strikeiron.com\/ProductDetail.aspx?p=168\">via StrikeIron<\/a>);\n\n<pre>\nGetNewHomeBuyers\nCountNewHomeBuyers\nGetRemainingHits\n<\/pre>\n\n<p>&#8230; then, in generalizing those, you end up with three operations that all have to\nbe GET (since all are\n<a href=\"http:\/\/www.w3.org\/2001\/tag\/doc\/whenToUseGet.html#checklist\">&#8220;questions&#8221;<\/a>),\nwhich you obviously can&#8217;t have.  So what to do?  You use three services, of\ncourse!  Isn&#8217;t that a lot easier than the\n<a href=\"http:\/\/lists.w3.org\/Archives\/Public\/www-ws-desc\/2004Apr\/0044\">complexity<\/a> that\n<a href=\"http:\/\/lists.w3.org\/Archives\/Public\/www-ws-desc\/2004Jan\/0173\">ensues<\/a>\nwhen the architectural style punts on the hard decisions?<\/p>\n\n<p>Note that those three services\nare, IMO, at the <em>perfect<\/em> level of granularity; data sources, identified by\na single, universally recognizable, compact string, requiring that client use nothing\nmore than\n<a href=\"http:\/\/en.wikipedia.org\/wiki\/World_Wide_Web\">existing infrastructure<\/a>\nto access the data held by the services (assuming the string begins &#8220;http:&#8221;, of\ncourse).  Simple.  Minimal cost.  And pervasive to boot.<\/p>\n\n<p>Gotta love the Web.<\/p>\n\n<p>P.S. &#8220;sinks&#8221; in the title of this post refers to what you get when you generalize\nnon-idempotent mutating operations like &#8220;orderBook&#8221;, &#8220;printDocument&#8221;, etc&#8230;  They\ngeneralize down to POST instead of GET, and therefore each become a service to which\none can chuck data; hence they become &#8220;sinks&#8221;.","protected":false},"excerpt":{"rendered":"The topic of service granularity popped up a couple of times a few weeks ago. And though I&#8217;m a bit late to the discussion, I&#8217;d like to contribute because I think there&#8217;s an important point here which is related to REST, as James anticipated, but didn&#8217;t expand upon &#8211; apparently he chose to play his [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[22],"class_list":["post-1193","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-rest"],"_links":{"self":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/comments?post=1193"}],"version-history":[{"count":0,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/1193\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/media?parent=1193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/categories?post=1193"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/tags?post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}