What is the difference between the Strategy and Template patterns?
- The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. The Template pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.
- The Strategy pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses, while the Template pattern defines a family of algorithms and makes them interchangeable.
- The Template pattern is used to allow for loose coupling between the sender of a request and its receivers, while the Strategy pattern provides a unified interface to a set of interfaces in a subsystem.
- The Template pattern is used to convert the interface of a class into another interface clients expect, while the Strategy pattern allows sending requests to objects without knowing anything about the operation being requested or the receiver of the request.
The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable, while the Template pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.
Loading...