TEMPLATEPATTERN
Introduction
• Take a look at the definition of a template……
• Template is a preset format, used as a starting point for a
particular application so that the format does not have to
be recreated each time it is used.
• Template Method Pattern defines a sequence of steps of
an algorithm.
• The subclasses are allowed to override the steps but not
allowed to change the sequence.
RealTimeExample-01
Template Method [Build
a House]
1)Building Foundation
2)Building Pillars
3)Building Walls
4)Building Windows
Concrete House
Wooden House
Foundation
Pillars
Walls
Windows
RealTimeExample-02
Car Skeleton
Car Engine
Car Door
BMW Car
Ferrari Car
Template
Method[Build Car]
1)Build Car Skeleton
2)Install Engine
3)Install Door
Template pattern

Template pattern

  • 1.
  • 2.
    Introduction • Take alook at the definition of a template…… • Template is a preset format, used as a starting point for a particular application so that the format does not have to be recreated each time it is used. • Template Method Pattern defines a sequence of steps of an algorithm. • The subclasses are allowed to override the steps but not allowed to change the sequence.
  • 3.
    RealTimeExample-01 Template Method [Build aHouse] 1)Building Foundation 2)Building Pillars 3)Building Walls 4)Building Windows Concrete House Wooden House Foundation Pillars Walls Windows
  • 4.
    RealTimeExample-02 Car Skeleton Car Engine CarDoor BMW Car Ferrari Car Template Method[Build Car] 1)Build Car Skeleton 2)Install Engine 3)Install Door

Editor's Notes

  • #3 template is a preset format, used as a starting point for a particular application so that the format does not have to be recreated each time it is used.