Question on pipelines-Collection of common programming errors

John,

The pipelines are meant to execute a set of uniform business logic on all orders, such that every order placed on the system uses the exact same entry point to calculate taxes, check discounts, validate inventory, et al.

To be fair, I don’t know that there is any performance benefit from using pipelines instead of runtime methods/classes, but the product team should probably clarify that.  I recently had another developer I work with ask me the “Why pipelines?” question, and I still struggle for an honest answer to this, but here is my best effort at answering.

  1. Legacy support – Pipelines have been a part of Commerce Server for it’s entire existence.  A lot of people have spent time/resources developing pipeline components to execute custom business logic specific to their scenario, and it wouldn’t be fair to simply deprecate pipelines after so much has already been invested into them.  This argument doesn’t really apply to developers who are new to the system, since most of us don’t actually have any legacy pipeline components to maintain.
  2. Reinventing the Wheel – The Microsoft Product Team has spent countless hours creating the “pipeline framework” and verifying that it works correctly.  It’s only fair to your customers to leverage the out-of-the-box pipeline components to keep total development complexity manageable.  Basically, there’s already so much of the logic that already lives in the pipelines, it doesn’t make sense to redevelop this on your customer’s dollar.

Of course, the next question most people ask is why not just leave the pipelines alone, and then put all of the “custom logic” into distinct method calls?  Honestly, there’s no reason you can’t do this, if you so choose.  My argument against this sort of thing is that it becomes very difficult to maintain your code and troubleshoot errors.  If all of your business logic lives within the pipelines, it’s pretty easy to figure out where to look for business logic errors!  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. 

Again, this is the opinion of one Commerce Server developer, so I’m sure the product team can offer some additional answers to your question.