{"id":5021,"date":"2014-03-30T17:59:22","date_gmt":"2014-03-30T17:59:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/question-on-pipelines-collection-of-common-programming-errors\/"},"modified":"2014-03-30T17:59:22","modified_gmt":"2014-03-30T17:59:22","slug":"question-on-pipelines-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/question-on-pipelines-collection-of-common-programming-errors\/","title":{"rendered":"Question on pipelines-Collection of common programming errors"},"content":{"rendered":"<p>John,<\/p>\n<p>The pipelines are meant to execute a set of uniform business logic on all orders, such that\u00a0every order placed on the system uses the exact same entry point to calculate taxes, check discounts, validate inventory, et al.<\/p>\n<p>To be fair, I\u00a0don&#8217;t know\u00a0that there is any performance benefit from using pipelines instead of runtime methods\/classes, but the product team should probably clarify that.\u00a0 I recently had another developer I work with ask me the &#8220;Why pipelines?&#8221; question, and I still struggle for an honest answer to this, but here is my best effort at answering.<\/p>\n<ol>\n<li>Legacy support &#8211; Pipelines have been a part of Commerce Server for it&#8217;s entire existence.\u00a0 A lot of people have spent time\/resources developing pipeline components to execute custom business logic specific to their scenario, and it wouldn&#8217;t be fair to simply deprecate pipelines after so much has already been invested into them.\u00a0 This argument doesn&#8217;t really apply to developers who are new to the system, since most of us don&#8217;t actually have any legacy pipeline components to maintain.<\/li>\n<li>Reinventing the Wheel &#8211; The Microsoft Product Team has spent countless hours creating the &#8220;pipeline framework&#8221; and verifying that it works correctly.\u00a0 It&#8217;s only fair to your customers to leverage the out-of-the-box pipeline components to keep total development complexity manageable.\u00a0 Basically, there&#8217;s already so much of the logic that already lives in the pipelines, it doesn&#8217;t make sense to redevelop this on your customer&#8217;s dollar.<\/li>\n<\/ol>\n<p>Of course, the next question most people ask is why not just leave the pipelines alone, and then put all of the &#8220;custom logic&#8221; into distinct method calls?\u00a0 Honestly, there&#8217;s no reason you can&#8217;t do this, if you so choose.\u00a0 My argument against this sort of thing is that it becomes very difficult to maintain your code and troubleshoot errors.\u00a0 If all of your business logic lives within the pipelines, it&#8217;s pretty easy to figure out where to look for business logic errors!\u00a0 On the other hand, if you start mixing where the business logic layer lives, it suddenly becomes very difficult to isolate errors down the road.\u00a0<\/p>\n<p>Again, this is the opinion of one Commerce Server developer, so I&#8217;m sure the product team can offer some additional answers to your question.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>John, The pipelines are meant to execute a set of uniform business logic on all orders, such that\u00a0every order placed on the system uses the exact same entry point to calculate taxes, check discounts, validate inventory, et al. To be fair, I\u00a0don&#8217;t know\u00a0that there is any performance benefit from using pipelines instead of runtime methods\/classes, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5021","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5021"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5021\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}