Strategy and Template patterns are similar in that they allow differentimplementations for a fixed set of behaviors. Their intents are different, however.Strategy is used to allow different implementations of an algorithm, or operation, tobe selected dynamically at run time. Typically, any common behavior is implementedin an abstract class and concrete subclasses provide the behavior that differs. Theclient is generally aware of the different strategies that are available and can choosebetween them.For example, an abstract class, Sensor, could define taking measurements andconcrete subclasses would be required to implement different techniques: one mightprovide a running average, another might provide an instantaneous measurement,and yet another might hold a peak (or low) value for some period of time.The intention of the Template pattern is not to allow behavior to be implemented indifferent ways, as in Strategy, but rather to ensure that certain behaviors areimplemented. In other words, where the focus of Strategy is to allow variety, thefocus of Template is to enforce consistency.The Template pattern is implemented as an abstract class and it is often used toprovide a blueprint or an outline for concrete subclasses. Sometimes this is used toimplement hooks in a system, such as an application framework.