SOFTWARE ENGINEERING

SOFTWARE DESIGN

DESIGN PATTERNS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which statement is correct?
A
The Observer Pattern defines a many-to-many relationship.
B
The Observer Pattern defines a one-to-many relationship.
C
The Observer Pattern defines a one-to-one relationship.
D
The Observer Pattern defines a many-to-one relationship.
Explanation: 

Detailed explanation-1: -The observer pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. The object which is being watched is called the subject. The objects which are watching the state changes are called observers or listeners.

Detailed explanation-2: -Observer pattern (also known as Publish-Subscribe Pattern) is used when there is one-to-many relationship between objects such as if one object is modified, its dependent objects are to be notified automatically.

Detailed explanation-3: -The Observer defines a one-to-many relationship so that when one object changes state, the others are notified and updated automatically. Some auctions demonstrate this pattern.

There is 1 question to complete.