Multiple choice technology architecture

Which pattern is used to allow different implementations of an algorithm or operation to be selected dynamically at runtime?

  1. Façade Pattern.

  2. Adapter Pattern

  3. Strategy Pattern.

  4. Factory pattern.

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

The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. The algorithm can vary independently from the clients that use it, and different strategies can be selected at runtime. This is exactly 'dynamic selection of algorithm implementations'. Facade and Adapter are structural patterns concerned with interfaces, not algorithm selection.