- Define the skeleton of an algorithm in an operation, deferring some steps to subclasses
- Provide an abstract definition for a method or a class and redefine its behavior later or on the fly without changing its structure.
- Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Where to use ?
- To make many similar operations template
- From many specialized operations to a generalized operation
- Refactor common behavior to simplify code
- Easy to produce ambiguity if not written well
No comments:
Post a Comment
Note: only a member of this blog may post a comment.