Multiple choice technology architecture

The -------------- Method pattern should be used to implement the invariant parts of an algorithm once and leaves it up to subclasses to implement the behavior that can vary.

  1. Strategy Pattern.

  2. Template Pattern.

  3. Observer Pattern.

  4. None of the above.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Template Method pattern defines the skeleton of an algorithm in a base class but defers some steps to subclasses. This allows the invariant parts (unchanging steps) to be implemented once in the base class while letting subclasses customize the variable parts. Strategy pattern defines a family of algorithms, and Observer pattern defines a subscription mechanism.