The template method allow separate the generic method from a detail context(class) via inheritance
Another advantage:
1.Inheritance implementation means that you will know the actual method implementation class before compilation,it is very big advantage to strategy pattern because it increase viscosity of program.
2.The combination of generic method is limited.
3.The combination of generic method is very meaningful(ease of naming)(allow mapping from requirement).
We normally see it on activity.
I have also see the template method in network layer(implemented by foreigner) with the combination of command pattern.If there is a reply below I will added it and explain.
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-09-29 11:16:30