The template mode is a very simple behavior class mode.
The template method gof defines the algorithm skeleton in a method and delays some steps to its subclass.
The template pattern contains an abstract class and its implementation class. We define the skeleton in the abstract class and all the methods required are abstract methods. The specific implementation is completed by its subclass.
Eg:
Public abstract class template {
Public void printdate (){
// Display the sorted list
Sort (list );
}
Public list sort (list );
}
Public class concretetemplate extends template {
Public list sort (){
// Specific sorting method
}
}
The benefit of the template mode is that development can be performed at the same time. When the primary programmer writes the system skeleton, other programmers can define abstract methods based on specific implementation processes.