Description
Defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure.
Where to use
- Data analysis pipelines. \n
- Build scripts.
Real World Example
A Data Miner. Steps: openFile() -> extractData() -> userMethod() -> closeFile(). Subclasses only implement extractData().
Code Example
class TemplateMethod:
def __init__(self):
pass
def execute(self):
print('Executing Template Method')
