Java · Medium · Pro
Template method in abstract classes — hooks vs final steps?
JavaDesign PatternsSeniorOOP
Template method
Define an algorithm skeleton in an abstract base class with final template steps and protected hooks subclasses override. Subclasses customize steps without reordering the workflow.
| Keyword | Role | Example |
|---|---|---|
final template method | Fixed step order | processOrder() |