SOFTWARE ENGINEERING

SOFTWARE DESIGN

DESIGN PATTERNS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The OBSERVER pattern suggests that you add an
A
concept of a finite state machine
B
subscription to a chain of events
C
extract traversal behavior from a collection to an object
D
put a new behavior in a separate class called visitor
Explanation: 

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.

There is 1 question to complete.