SOFTWARE DESIGN
DESIGN PATTERNS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Regarding the Observer Pattern, which statement is NOT correct?
|
We can add new observers at any time.
|
|
We never need to modify the subject to add new types of observers.
|
|
We can reuse subjects or observers independently of each other.
|
|
Changes to either the subject or an observer will always affect the other.
|
Explanation:
Detailed explanation-1: -The Observer Pattern defines a one to many dependency between objects so that one object changes state, all of its dependents are notified and updated automatically. Explanation: One to many dependency is between Subject(One) and Observer(Many). There is dependency as Observers themselves don’t have access to data.
Detailed explanation-2: -The main disadvantage of the observer design pattern that subscribers are notified in random order.
There is 1 question to complete.