Welcome to the Design Patterns Demystified (DPD) series, in this edition we are going to discuss Template Design Pattern. So let us understand the why, how, what, and where of Template Design Pattern.
The Why
Let us understand first, why we need this pattern with the help of an example. Let’s you are building a reusable library which is orchestrating the operation of buying an item on an e-commerce platform. Now, irrespective of what you are buying, you will follow the same sequence of steps like building your cart, adding an address, filling in payment details, and then finishing the payment. The details in these steps will vary based on what you are buying, how much you are buying, the delivery address, and the preferred mode of payment, but the complete orchestration of steps remains the same.
Welcome to the Design Patterns Demystified (DPD) series, in this edition we are going to discuss Template Design Pattern. So let us understand the why, how, what, and where of Template Design Pattern.
The Why
Let us understand first, why we need this pattern with the help of an example. Let’s you are building a reusable library which is orchestrating the operation of buying an item on an e-commerce platform. Now, irrespective of what you are buying, you will follow the same sequence of steps like building your cart, adding an address, filling in payment details, and then finishing the payment. The details in these steps will vary based on what you are buying, how much you are buying, the delivery address, and the preferred mode of payment, but the complete orchestration of steps remains the same. […]