SOFTWARE DESIGN
DESIGN PATTERNS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Use this pattern when you have a class polluted with massive conditionals that alter how the class behaves according to the current values of the class’s fields. What pattern?
|
Observer
|
|
Mediator
|
|
State
|
|
Strategy
|
Explanation:
Detailed explanation-1: -Intent. State is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class.
Detailed explanation-2: -Today’s pattern is the State pattern, which allows objects to behave in different ways depending on internal state. State is used when you need a class to behave differently, such as performing slightly different computations, based on some arguments passed through to the class.
There is 1 question to complete.