SOFTWARE DESIGN
DESIGN PATTERNS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
concept of a finite state machine
|
|
subscription to a chain of events
|
|
extract traversal behavior from a collection to an object
|
|
put a new behavior in a separate class called visitor
|
Detailed explanation-1: -The Observer pattern suggests that you add a subscription mechanism to the publisher class so individual objects can subscribe to or unsubscribe from a stream of events coming from that publisher.
Detailed explanation-2: -According to GoF definition, observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. It is also referred to as the publish-subscribe pattern.
Detailed explanation-3: -An Observer Pattern says that “just define a one-to-one dependency so that when one object changes state, all its dependents are notified and updated automatically". The observer pattern is also known as Dependents or Publish-Subscribe.