Tag Archives: OOP

Supporting Different Clients with Template Method Design Pattern

Template Method Design Pattern is good for when you have a  similar solution that you need to implement for different clients with variations on that solution.  I came across this design pattern when I was having to implement consuming of the Avalara Tax API for different retail clients e-commerce shops.

Basically the Avalara Tax API allows clients to send information for various products and orders in their system to the service which will help calculate the rate for these orders and store them in the system for recording keeping and more accuracy in the future.

This design pattern is good because the data varies from client to client that we want to send to the API or how we want to construct that data for each client, however most of the data we want to send is basically the same with small variations.

Sample code below:

 

404 page not found