samedi 16 mai 2020

Observer pattern: case of multiple registration of the same instance

I'm studying the observer, a kind of design pattern.

The observable object contains a list of observers. A list can accept redundant an observer instance. So we can limit this redundancy using a hash set instead of a list.

My question is, if we allow redundant registration of the same observer instance, is there any example that the observer is registered more than one time? Why the same observer is registered to the same observable multiple times?

Aucun commentaire:

Enregistrer un commentaire