SOFTWARE DESIGN
DESIGN PATTERNS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Command
|
|
Mediator
|
|
State
|
|
Observer
|
Detailed explanation-1: -Use the State pattern when you have an object that behaves differently depending on its current state, the number of states is enormous, and the state-specific code changes frequently. The pattern suggests that you extract all state-specific code into a set of distinct classes.
Detailed explanation-2: -The state pattern is used in computer programming to encapsulate varying behavior for the same object, based on its internal state. This can be a cleaner way for an object to change its behavior at runtime without resorting to conditional statements and thus improve maintainability.
Detailed explanation-3: -State design pattern is one of the behavioral design pattern. State design pattern is used when an Object change its behavior based on its internal state.
Detailed explanation-4: -Memento. The Memento pattern is useful if a certain state of an object should be saved for later usage.