13.10.2021
Template Model
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses which may differ. Template method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure. This Pattern was identified in the book Design Patterns
Example:
public abstract class Development {
// Skeleton algorithm of a Development Workday
public void work() {
drinkCoffee();
haveAMeeting();
doCode();
talkToColleagues();
drinkCoffee();
haveAMeeting();
doCodeReview();
}
// Template Method
protected abstract void doCodeReview();
// Template Method
protected abstract void doCode();
private void haveAMeeting() {
System.out.println("lala ...");
}
private void talkToColleagues() {
System.out.println("bla ...");
}
public void drinkCoffee() {
System.out.println("Sip ...");
}
}
see also https://en.wikipedia.org/wiki/Template_method_pattern
Standort Hannover
newcubator GmbH
Bödekerstraße 22
30161 Hannover
Standort Dortmund
newcubator GmbH
Westenhellweg 85-89
44137 Dortmund