SOFTWARE ENGINEERING

SOFTWARE DESIGN

DESIGN PATTERNS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Use the ____ pattern when you want to use different variants of an algorithm within an object and be able to switch from one algorithm to another during runtime.
A
State
B
Mediator
C
Strategy
D
Template Method
Explanation: 

Detailed explanation-1: -Use the Strategy pattern when you want to use different variants of an algorithm within an object and be able to switch from one algorithm to another during runtime. Use the Strategy when you have a lot of similar classes that only differ in the way they execute some behavior. More items •11-May-2021

Detailed explanation-2: -Decorator design pattern is used to modify the functionality of an object at runtime. At the same time other instances of the same class will not be affected by this, so individual object gets the modified behavior.

Detailed explanation-3: -In computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime.

There is 1 question to complete.