Design Pattern: Visitor Pattern

Visitor pattern moves the operation or calculation part from the element/subject classes to a completely separate class. That separate class is called the visitor. As the operation/calculation is moved to the visitor class, so if we want to change the operation then we can just change the visitor class. No change in the subject classes is required in that case.

Design Pattern: Template Method Pattern

Template method pattern when we want the subclasses to define some steps of the processing steps (or algorithm). The parent class can define some steps and subclasses can some(which are required). Functionalities/steps which are completely different for subclasses are left to the subclasses for definition. The parent (abstract) class works are a skeleton here.